Java Qt Extensions

Examples

Example1 - Hello World

A basic Hello World example. It creates and displays a Hello World label component.

Most of QSwing components can be displayed outside of the top-level containers (the feature is mainly for development purposes). The major drawback, comparing to Swing, is that the GUI event loop needs to be explicitly started by invoking the QSwing.startEventLoop() method. This method does not return until the GUI event loop quits. It is strongly recommended that the GUI event loop is started from the application's main thread (the thread that calls the main method). This is because some platforms do not allow the GUI event loop to run outside the main thread. Windows and Linux allow this but it is not portable in general.

Code

package yu.ac.bg.etf.javaqx.examples;

import yu.ac.bg.etf.javaqx.qswing.JQLabel;
import yu.ac.bg.etf.javaqx.qswing.QSwing;

/**
 * HelloWorld Example.
 */
public class Example1HelloWorld {

  public static void main(String[] args) {
    JQLabel label = new JQLabel("Hello World");
    label.setVisible(true);
    QSwing.startEventLoop(true);
  }

}

Screenshots

HelloWorld on
Windows Vista
HelloWorld on
Windows XP
HelloWorld on
Windows 98
HelloWorld on
SUSE Linux
HelloWorld on
Ubuntu Linux