001: package net.xoetrope.samples.controls;
002:
003: import java.awt.Frame;
004: import java.awt.event.WindowEvent;
005: import java.awt.event.WindowListener;
006:
007: import net.xoetrope.awt.XButton;
008: import net.xoetrope.xui.XPage;
009: import net.xoetrope.xui.XProjectManager;
010: import net.xoetrope.xui.build.BuildProperties;
011:
012: /**
013: * <p>Title: Xui</p>
014: * <p>Description: </p>
015: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
016: * <p>Company: Xoetrope Ltd.</p>
017: * @author Xoetrope Ltd.
018: * @version 1.0
019: */
020:
021: public class SamplesHome extends XPage implements WindowListener {
022: XButton ctlSampleButton, hsSampleButton, metaSampleButton,
023: styleSampleButton, buddySampleButton, dialogSampleButton;
024: XButton validationSample, dataSample, tableSample, tabSample,
025: splitterSample;
026: Frame frame;
027:
028: public SamplesHome() {
029: frame = new Frame("Samples Home");
030: frame.setLayout(null);
031: frame.setSize(640, 480);
032: frame.addWindowListener(this );
033:
034: componentFactory.setParentComponent(frame);
035: componentFactory
036: .addComponent(XPage.LABEL, 10, 50, 330, 50,
037: "Please click one of the buttons below for some simple examples ");
038: ctlSampleButton = (XButton) componentFactory.addComponent(
039: "BUTTON", 10, 100, 130, 25, "Controls sample");
040: hsSampleButton = (XButton) componentFactory.addComponent(
041: "BUTTON", 10, 130, 130, 25, "Hotspot sample");
042: styleSampleButton = (XButton) componentFactory.addComponent(
043: "BUTTON", 10, 160, 130, 25, "Style sample");
044: metaSampleButton = (XButton) componentFactory.addComponent(
045: "BUTTON", 10, 190, 130, 25, "Meta sample");
046: buddySampleButton = (XButton) componentFactory.addComponent(
047: "BUTTON", 10, 220, 130, 25, "Buddy sample");
048:
049: dialogSampleButton = (XButton) componentFactory.addComponent(
050: XPage.BUTTON, 150, 100, 130, 25, "Dialog sample");
051: validationSample = (XButton) componentFactory.addComponent(
052: XPage.BUTTON, 150, 130, 130, 25, "Validation sample");
053: dataSample = (XButton) componentFactory.addComponent(
054: XPage.BUTTON, 150, 160, 130, 25, "Data sample");
055: tableSample = (XButton) componentFactory.addComponent(
056: XPage.BUTTON, 150, 190, 130, 25, "Table sample");
057: tabSample = (XButton) componentFactory.addComponent(
058: XPage.BUTTON, 150, 220, 130, 25, "Tab sample");
059: splitterSample = (XButton) componentFactory.addComponent(
060: XPage.BUTTON, 150, 250, 130, 25, "Splitter sample");
061:
062: setupHandlers();
063: frame.setVisible(true);
064: frame.show();
065: }
066:
067: public void setupHandlers() {
068: addMouseHandler(ctlSampleButton, "controlsSample");
069: addMouseHandler(hsSampleButton, "hotspotSample");
070: addMouseHandler(styleSampleButton, "styleSample");
071: addMouseHandler(metaSampleButton, "metaSample");
072: addMouseHandler(buddySampleButton, "buddySample");
073: addMouseHandler(dialogSampleButton, "dialogSample");
074:
075: addMouseHandler(validationSample, "validateSample");
076: addMouseHandler(dataSample, "dataSample");
077: addMouseHandler(tableSample, "tableSample");
078: addMouseHandler(tabSample, "tabSample");
079: addMouseHandler(splitterSample, "splitterSample");
080: }
081:
082: public void controlsSample() {
083: if (wasMouseClicked()) {
084: CompFactorySample samp = new CompFactorySample();
085: }
086: }
087:
088: public void hotspotSample() {
089: if (wasMouseClicked()) {
090: HotspotSample samp = new HotspotSample();
091: }
092: }
093:
094: public void metaSample() {
095: if (wasMouseClicked()) {
096: MetaSample samp = new MetaSample();
097: }
098: }
099:
100: public void styleSample() {
101: if (wasMouseClicked()) {
102: StyleSample samp = new StyleSample();
103: }
104: }
105:
106: public void buddySample() {
107: if (wasMouseClicked()) {
108: BuddySample samp = new BuddySample();
109: }
110: }
111:
112: public void dialogSample() {
113: if (wasMouseClicked()) {
114: DialogSample samp = new DialogSample();
115: }
116: }
117:
118: public void validateSample() {
119: if (wasMouseClicked()) {
120: ValidationSample samp = new ValidationSample();
121: }
122: }
123:
124: public void dataSample() {
125: if (wasMouseClicked()) {
126: DataSample samp = new DataSample();
127: }
128: }
129:
130: public void tableSample() {
131: if (wasMouseClicked()) {
132: TableSample samp = new TableSample();
133: }
134: }
135:
136: public void tabSample() {
137: if (wasMouseClicked()) {
138: TabSample samp = new TabSample();
139: }
140: }
141:
142: public void splitterSample() {
143: if (wasMouseClicked()) {
144: SplitPaneSample samp = new SplitPaneSample();
145: }
146: }
147:
148: public static void main(String args[]) {
149: XProjectManager.getCurrentProject().initialise(
150: "startup.properties");
151: SamplesHome sampleHome = new SamplesHome();
152: }
153:
154: public void windowClosing(WindowEvent we) {
155: System.exit(0);
156: }
157:
158: public void windowActivated(WindowEvent we) {
159: }
160:
161: public void windowDeactivated(WindowEvent we) {
162: }
163:
164: public void windowDeiconified(WindowEvent we) {
165: }
166:
167: public void windowIconified(WindowEvent we) {
168: }
169:
170: public void windowClosed(WindowEvent we) {
171: }
172:
173: public void windowOpened(WindowEvent we) {
174: }
175: }
|