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