| Java-GNOME 2.10 GNOME Tutorial | ||
|---|---|---|
| <<< Previous | Containers | Next >>> |
The Frame container is capable of containing one widget and it places a rectangle box around it. You can also have a label attached to the box. The box can have different appearances which is described by type ShadowType. The possible vales for ShadowType are as follows:
Here is a little bit of the createLabels() method from TestGTK to demonstrate the usage of Frame.
Example 2. TestGTK.java - Frame
public void createLabels() {
Window win = new Window(WindowType.TOPLEVEL);
win.setTitle("labels");
win.setBorderWidth(5);
VBox vbox1 = new VBox(false, 5);
HBox hbox = new HBox(false, 5);
win.add(hbox);
hbox.packStart(vbox1, false, false, 0);
Frame frame = new Frame("Normal Label");
Label label = new Label("This is a Normal Label");
frame.add(label);
vbox1.packStart(frame, false, false, 0);
frame = new Frame("Multi-Line Label");
label = new Label("This is a Multi-Line Label. \nSecond line\nThird line");
frame.add(label);
vbox1.packStart(frame, false, false, 0);
frame = new Frame("Left Justiied Label");
label = new Label("This is a Left-Justified\nMulti-line label.\nThird line");
label.setJustification(Justification.LEFT);
frame.add(label);
vbox1.packStart(frame, false, false, 0); |
| <<< Previous | Home | Next >>> |
| Containers | Up | AspectFrame |