summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/tutorial/t5/Tut5.java
blob: 7b3fa60ae927f0bfa7ce736389058e9fe4b78df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import org.kde.qt.*;

public class Tut5 extends TQVBox {
	public Tut5() {
		TQPushButton quit = new TQPushButton("Quit", this, "quit");
		quit.setFont(new TQFont("Times", 18, TQFont.Bold, false));

		connect(quit, SIGNAL("clicked()"), qApp(), SLOT("quit()"));

		TQLCDNumber lcd = new TQLCDNumber(2, this, "lcd");

		TQSlider slider = new TQSlider(Horizontal, this, "slider");
		slider.setRange(0, 99);
		slider.setValue(0);

		connect(slider, SIGNAL("valueChanged(int)"), lcd, SLOT("display(int)"));
	}
	
	public static void main(String[] args) {
		TQApplication a = new TQApplication(args);

		Tut5 w = new Tut5();
		a.setMainWidget(w);
		w.show();
		a.exec();
		return;
	}
	
	static {
		try {
			Class c = Class.forName("org.kde.qt.qtjava");
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Can't load qtjava class");
		}
	}
}