diff options
Diffstat (limited to 'qtjava/javalib/examples/aclock')
-rw-r--r-- | qtjava/javalib/examples/aclock/AnalogClock.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/qtjava/javalib/examples/aclock/AnalogClock.java b/qtjava/javalib/examples/aclock/AnalogClock.java index 2d97cb67..a0ced62a 100644 --- a/qtjava/javalib/examples/aclock/AnalogClock.java +++ b/qtjava/javalib/examples/aclock/AnalogClock.java @@ -11,25 +11,25 @@ import org.kde.qt.*; import java.util.Date; -class AnalogClock extends QWidget // analog clock widget +class AnalogClock extends TQWidget // analog clock widget { private Date time; // -// Constructs an analog clock widget that uses an internal QTimer. +// Constructs an analog clock widget that uses an internal TQTimer. // -public AnalogClock( QWidget parent ) +public AnalogClock( TQWidget parent ) { this(parent, null); } -public AnalogClock( QWidget parent, String name ) +public AnalogClock( TQWidget parent, String name ) { super( parent, name ); time = new Date(); // get current time - QTimer internalTimer = new QTimer( this ); // create internal timer + TQTimer internalTimer = new TQTimer( this ); // create internal timer connect( internalTimer, SIGNAL("timeout()"), SLOT("timeout()") ); internalTimer.start( 5000 ); // emit signal every 5 seconds } @@ -42,7 +42,7 @@ public void setTime( Date t ) } // -// The QTimer.timeout() signal is received by this slot. +// The TQTimer.timeout() signal is received by this slot. // public void timeout() @@ -59,11 +59,11 @@ public void timeout() } -public void paintEvent( QPaintEvent event ) +public void paintEvent( TQPaintEvent event ) { if ( autoMask() ) return; - QPainter paint = new QPainter( this ); + TQPainter paint = new TQPainter( this ); paint.setBrush( colorGroup().foreground() ); drawClock( paint ); } @@ -73,10 +73,10 @@ public void paintEvent( QPaintEvent event ) public void updateMask() // paint clock mask { - QBitmap bm = new QBitmap( size() ); + TQBitmap bm = new TQBitmap( size() ); bm.fill( color0() ); //transparent - QPainter paint = new QPainter(); + TQPainter paint = new TQPainter(); paint.begin( bm, this ); paint.setBrush( color1() ); // use non-transparent color paint.setPen( color1() ); @@ -92,19 +92,19 @@ public void updateMask() // paint clock mask // the a centered square, as big as possible. The painter's pen and // brush colors are used. // -public void drawClock( QPainter paint ) +public void drawClock( TQPainter paint ) { paint.save(); paint.setWindow( -500,-500, 1000,1000 ); - QRect v = paint.viewport(); + TQRect v = paint.viewport(); int d = v.width() < v.height() ? v.width() : v.height(); paint.setViewport( v.left() + (v.width()-d)/2, v.top() + (v.height()-d)/2, d, d ); - // time = QTime.currentTime(); - QPointArray pts = new QPointArray(); + // time = TQTime.currentTime(); + TQPointArray pts = new TQPointArray(); paint.save(); paint.rotate( 30*(time.getHours()%12-3) + time.getMinutes()/2 ); @@ -138,7 +138,7 @@ public void setAutoMask(boolean b) public static void main( String[] args ) { - QApplication a = new QApplication( args ); + TQApplication a = new TQApplication( args ); AnalogClock clock = new AnalogClock(null, null); if ( args.length == 1 && args[0].equals("-transparent") ) clock.setAutoMask( true ); |