summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/examples/drawlines/ConnectWidget.java
diff options
context:
space:
mode:
Diffstat (limited to 'qtjava/javalib/examples/drawlines/ConnectWidget.java')
-rw-r--r--qtjava/javalib/examples/drawlines/ConnectWidget.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/qtjava/javalib/examples/drawlines/ConnectWidget.java b/qtjava/javalib/examples/drawlines/ConnectWidget.java
index c51f2703..0292b9a2 100644
--- a/qtjava/javalib/examples/drawlines/ConnectWidget.java
+++ b/qtjava/javalib/examples/drawlines/ConnectWidget.java
@@ -13,13 +13,13 @@ import java.util.Random;
//
// ConnectWidget - draws connected lines
//
-class ConnectWidget extends QWidget
+class ConnectWidget extends TQWidget
{
static final int MAXPOINTS = 2000; // maximum number of points
static final int MAXCOLORS = 40;
-private QPoint[] points; // point array
-private QColor[] colors; // color array
+private TQPoint[] points; // point array
+private TQColor[] colors; // color array
private int count; // count = number of points
private boolean down; // true if mouse down
private Random generator = new Random(System.currentTimeMillis());
@@ -32,16 +32,16 @@ public ConnectWidget( )
this(null, null);
}
-public ConnectWidget( QWidget parent, String name )
+public ConnectWidget( TQWidget parent, String name )
{
super( parent, name, WStaticContents );
setBackgroundColor( white() ); // white background
count = 0;
down = false;
- points = new QPoint[MAXPOINTS];
- colors = new QColor[MAXCOLORS];
+ points = new TQPoint[MAXPOINTS];
+ colors = new TQColor[MAXCOLORS];
for ( int i=0; i<MAXCOLORS; i++ ) // init color array
- colors[i] = new QColor( generator.nextInt(255), generator.nextInt(255), generator.nextInt(255) );
+ colors[i] = new TQColor( generator.nextInt(255), generator.nextInt(255), generator.nextInt(255) );
}
@@ -49,9 +49,9 @@ public ConnectWidget( QWidget parent, String name )
// Handles paint events for the connect widget.
//
-protected void paintEvent( QPaintEvent e )
+protected void paintEvent( TQPaintEvent e )
{
- QPainter paint = new QPainter( this );
+ TQPainter paint = new TQPainter( this );
for ( int i=0; i<count-1; i++ ) { // connect all points
for ( int j=i+1; j<count; j++ ) {
paint.setPen( colors[generator.nextInt(MAXCOLORS)] ); // set random pen color
@@ -66,7 +66,7 @@ protected void paintEvent( QPaintEvent e )
// Handles mouse press events for the connect widget.
//
-protected void mousePressEvent( QMouseEvent e )
+protected void mousePressEvent( TQMouseEvent e )
{
down = true;
count = 0; // start recording points
@@ -78,7 +78,7 @@ protected void mousePressEvent( QMouseEvent e )
// Handles mouse release events for the connect widget.
//
-protected void mouseReleaseEvent( QMouseEvent e )
+protected void mouseReleaseEvent( TQMouseEvent e )
{
down = false; // done recording points
update(); // draw the lines
@@ -89,11 +89,11 @@ protected void mouseReleaseEvent( QMouseEvent e )
// Handles mouse move events for the connect widget.
//
-protected void mouseMoveEvent( QMouseEvent e )
+protected void mouseMoveEvent( TQMouseEvent e )
{
if ( down && count < MAXPOINTS ) {
- QPainter paint = new QPainter( this );
- points[count++] = new QPoint(e.pos()); // add point
+ TQPainter paint = new TQPainter( this );
+ points[count++] = new TQPoint(e.pos()); // add point
paint.drawPoint( e.pos() ); // plot point
paint.end();
}
@@ -106,7 +106,7 @@ protected void mouseMoveEvent( QMouseEvent e )
public static void main( String[] args )
{
- QApplication a = new QApplication( args );
+ TQApplication a = new TQApplication( args );
ConnectWidget connect = new ConnectWidget();
connect.setCaption( "Qt Example - Draw lines");
a.setMainWidget( connect );