diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtjava/javalib/examples/forever | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtjava/javalib/examples/forever')
-rw-r--r-- | qtjava/javalib/examples/forever/Forever.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/qtjava/javalib/examples/forever/Forever.java b/qtjava/javalib/examples/forever/Forever.java index 24cebcd3..8478898f 100644 --- a/qtjava/javalib/examples/forever/Forever.java +++ b/qtjava/javalib/examples/forever/Forever.java @@ -16,12 +16,12 @@ import java.util.Random; -class Forever extends QWidget +class Forever extends TQWidget { static final int numColors = 120; private int rectangles; -private QColor[] colors = new QColor[numColors]; +private TQColor[] colors = new TQColor[numColors]; private Random generator = new Random(System.currentTimeMillis()); @@ -38,17 +38,17 @@ Forever( ) this(null, null); } -Forever( QWidget parent, String name ) +Forever( TQWidget parent, String name ) { super( parent, name ); for (int a=0; a<numColors; a++) { - colors[a] = new QColor( generator.nextInt(255), + colors[a] = new TQColor( generator.nextInt(255), generator.nextInt(255), generator.nextInt(255) ); } rectangles = 0; startTimer( 0 ); // run continuous timer - QTimer counter = new QTimer( this ); + TQTimer counter = new TQTimer( this ); connect( counter, SIGNAL("timeout()"), this, SLOT("updateCaption()") ); counter.start( 1000 ); @@ -67,9 +67,9 @@ void updateCaption() // Handles paint events for the Forever widget. // -protected void paintEvent( QPaintEvent e ) +protected void paintEvent( TQPaintEvent e ) { - QPainter paint = new QPainter( this ); // painter object + TQPainter paint = new TQPainter( this ); // painter object int w = width(); int h = height(); if(w <= 0 || h <= 0) @@ -77,10 +77,10 @@ protected void paintEvent( QPaintEvent e ) paint.setPen( NoPen ); // do not draw outline paint.setBrush( colors[generator.nextInt(numColors)]);// set random brush color -// QPoint p1 = new QPoint( generator.nextInt(w), generator.nextInt(h)); // p1 = top left -// QPoint p2 = new QPoint( generator.nextInt(w), generator.nextInt(h)); // p2 = bottom right +// TQPoint p1 = new TQPoint( generator.nextInt(w), generator.nextInt(h)); // p1 = top left +// TQPoint p2 = new TQPoint( generator.nextInt(w), generator.nextInt(h)); // p2 = bottom right -// QRect r = new QRect( p1, p2 ); +// TQRect r = new TQRect( p1, p2 ); // paint.drawRect( r ); // draw filled rectangle paint.drawRect( generator.nextInt(w), generator.nextInt(h), generator.nextInt(w), generator.nextInt(h) ); // draw filled rectangle @@ -90,7 +90,7 @@ protected void paintEvent( QPaintEvent e ) // Handles timer events for the Forever widget. // -protected void timerEvent( QTimerEvent e ) +protected void timerEvent( TQTimerEvent e ) { for ( int i=0; i<100; i++ ) { repaint( false ); // repaint, don't erase @@ -105,7 +105,7 @@ protected void timerEvent( QTimerEvent e ) public static void main( String[] args ) { - QApplication a = new QApplication( args ); // create application object + TQApplication a = new TQApplication( args ); // create application object Forever always = new Forever(); // create widget a.setMainWidget( always ); // set as main widget always.setCaption("Qt Example - Forever"); |