01: package net.xoetrope.samples.controls;
02:
03: import java.awt.Button;
04: import java.awt.Frame;
05:
06: import net.xoetrope.awt.XButton;
07: import net.xoetrope.xui.XPage;
08:
09: /**
10: * <p>Title: Xui</p>
11: * <p>Description: </p>
12: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
13: * <p>Company: Xoetrope Ltd.</p>
14: * @author Xoetrope Ltd.
15: * @version 1.0
16: */
17:
18: public class CompFactorySample extends XPage {
19: XButton xbutton, closeButton;
20: Button awtButton;
21: Frame frame;
22:
23: public CompFactorySample() {
24: frame = new Frame("ComponentFactory Sample");
25: frame.setLayout(null);
26: frame.setSize(640, 480);
27:
28: componentFactory.setParentComponent(frame);
29: componentFactory
30: .addComponent(
31: XPage.LABEL,
32: 10,
33: 50,
34: 330,
35: 150,
36: "This is a simple example of how the ComponentFactory works. First set the parent component in the factory and then add components to it in a single line. This label is an example of how the wrapping works within the XLabel ");
37: xbutton = (XButton) componentFactory.addComponent(XPage.BUTTON,
38: 10, 200, 130, 25, "XButton test");
39: awtButton = (Button) componentFactory.addComponent(
40: XPage.BUTTON, 10, 230, 130, 25);
41: awtButton.setLabel("AWT Button");
42: closeButton = (XButton) componentFactory.addComponent(
43: XPage.BUTTON, 10, 300, 130, 25, "Close");
44: this .addMouseHandler(closeButton, "Close");
45: frame.setVisible(true);
46: frame.show();
47: }
48:
49: public static void main(String args[]) {
50: CompFactorySample compSample = new CompFactorySample();
51: }
52:
53: public void Close() {
54: if (wasMouseClicked()) {
55: frame.setVisible(false);
56: }
57: }
58: }
|