The next example is a GUI-based hello world program, which uses black text on a red background:
|
Note that the window's zoom disk is gray, meaning the window cannot be resized. Here
is the code for the program:
import javax.swing.*;
import BreezySwing.*;
import java.awt.Color;
public class HelloWorld extends GBFrame{
// Set up the greting label by
adding it to a row and column in the window's grid
JLabel greetingLabel =
addLabel ("Hello world!", 1, 1, 1, 1);
// Create and display the window when the
app launches
public static
void main(String[] args){
JFrame frm = new HelloWorld();
frm.setSize
(100, 100);
frm.setResizable (false);
}
}
Back to tutorial | Next topic: Adding window components |