Die Klasse Frame ist wie folgt implementiert:
1 public class Frame extends FrameWrapper implements IFrame {
2
3 public Frame(final String title, final IImageConstant icon) {
4 this(BPF.frame(title).setIcon(icon));
5 }
6
7 public Frame(final String title) {
8 this(BPF.frame(title));
9 }
10
11 public Frame(final IFrameDescriptor descriptor) {
12 super(Toolkit.createRootFrame(descriptor));
13 }
14
15 protected IFrame getFrame() {
16 return (IFrame) super.getWidget();
17 }
18
19 }
Das
BaseFrameSnipped
demonstriert die Verwendung der Klasse Frame:
1 public final class BaseFrameSnipped implements IApplication {
2
3 @Override
4 public void start(final IApplicationLifecycle lifecycle) {
5
6 final IFrame frame = new MyFrame();
7
8 frame.addWindowListener(new WindowAdapter() {
9 @Override
10 public void windowClosed() {
11 lifecycle.finish();
12 }
13 });
14
15 frame.setVisible(true);
16 }
17
18 private final class MyFrame extends Frame {
19
20 public MyFrame() {
21 super("Base frame Snipped");
22
23 setMinPackSize(new Dimension(300, 0));
24
25 setLayout(new MigLayoutDescriptor("wrap", "[][grow]", "[][]"));
26
27 add(BPF.textLabel("Label 1"));
28 add(BPF.inputFieldString(), "growx");
29
30 add(BPF.textLabel("Label 2"));
31 add(BPF.inputFieldString(), "growx");
32 }
33
34 }
35 }