diff options
Diffstat (limited to 'qtjava/javalib/examples/hello')
-rw-r--r-- | qtjava/javalib/examples/hello/Hello.java | 18 | ||||
-rw-r--r-- | qtjava/javalib/examples/hello/Main.java | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/qtjava/javalib/examples/hello/Hello.java b/qtjava/javalib/examples/hello/Hello.java index c5e85041..742c49c0 100644 --- a/qtjava/javalib/examples/hello/Hello.java +++ b/qtjava/javalib/examples/hello/Hello.java @@ -9,7 +9,7 @@ ****************************************************************************/ import org.kde.qt.*; -class Hello extends QWidget +class Hello extends TQWidget { private String t; private int b = 0; @@ -23,11 +23,11 @@ Hello( String text ) this(text, null, null); } -Hello( String text, QWidget parent, String name ) +Hello( String text, TQWidget parent, String name ) { super(parent,name); t = text; - QTimer timer = new QTimer(this); + TQTimer timer = new TQTimer(this); connect( timer, SIGNAL("timeout()"), SLOT("animate()") ); timer.start( 40 ); @@ -53,7 +53,7 @@ void animate() the widget. */ -protected void mouseReleaseEvent( QMouseEvent e ) +protected void mouseReleaseEvent( TQMouseEvent e ) { if ( rect().contains( e.pos() ) ) emit("clicked"); @@ -69,24 +69,24 @@ protected void mouseReleaseEvent( QMouseEvent e ) Flicker-free update. The text is first drawn in the pixmap and the pixmap is then blt'ed to the screen. */ -protected void paintEvent( QPaintEvent e ) +protected void paintEvent( TQPaintEvent e ) { if ( t.equals("") ) return; // 1: Compute some sizes, positions etc. - QFontMetrics fm = fontMetrics(); + TQFontMetrics fm = fontMetrics(); int w = fm.width(t) + 20; int h = fm.height() * 2; int pmx = width()/2 - w/2; int pmy = height()/2 - h/2; // 2: Create the pixmap and fill it with the widget's background - QPixmap pm = new QPixmap( w, h ); + TQPixmap pm = new TQPixmap( w, h ); pm.fill( this, pmx, pmy ); // 3: Paint the pixmap. Cool wave effect - QPainter p = new QPainter(); + TQPainter p = new TQPainter(); int x = 10; int y = h/2 + fm.descent(); int i = 0; @@ -94,7 +94,7 @@ protected void paintEvent( QPaintEvent e ) p.setFont( font() ); while ( i < t.length() ) { int i16 = (b+i) & 15; - p.setPen( new QColor((15-i16)*16,255,255,QColor.Hsv) ); + p.setPen( new TQColor((15-i16)*16,255,255,TQColor.Hsv) ); p.drawText( x, y-sin_tbl[i16]*h/800, t.substring(i,i+1), 1 ); x += fm.width( t.substring(i,i+1) ); i++; diff --git a/qtjava/javalib/examples/hello/Main.java b/qtjava/javalib/examples/hello/Main.java index 1313b2cf..745b97f9 100644 --- a/qtjava/javalib/examples/hello/Main.java +++ b/qtjava/javalib/examples/hello/Main.java @@ -18,7 +18,7 @@ public class Main { public static void main( String[] args ) { - QApplication a = new QApplication(args); + TQApplication a = new TQApplication(args); String s = ""; for ( int i=1; i<args.length; i++ ) { s += args[i]; @@ -29,8 +29,8 @@ public static void main( String[] args ) s = "Hello, World"; Hello h = new Hello( s ); h.setCaption( "Qt says hello" ); - QObject.connect( h, Qt.SIGNAL("clicked()"), a, Qt.SLOT("quit()") ); - h.setFont( new QFont("times",32,QFont.Bold) ); // default font + TQObject.connect( h, Qt.SIGNAL("clicked()"), a, Qt.SLOT("quit()") ); + h.setFont( new TQFont("times",32,TQFont.Bold) ); // default font h.setBackgroundColor( Qt.white() ); // default bg color a.setMainWidget( h ); h.show(); |