01: package net.xoetrope.samples.controls;
02:
03: import java.io.File;
04:
05: import java.awt.Frame;
06:
07: import net.xoetrope.awt.XButton;
08: import net.xoetrope.awt.XComboBox;
09: import net.xoetrope.awt.XEdit;
10: import net.xoetrope.awt.XTable;
11: import net.xoetrope.data.XDataSource;
12: import net.xoetrope.xui.XPage;
13: import net.xoetrope.xui.XProjectManager;
14: import net.xoetrope.xui.XResourceManager;
15: import net.xoetrope.xui.data.XModel;
16: import net.xoetrope.xui.helper.BuddyHelper;
17: import net.xoetrope.xui.style.XStyleFactory;
18: import net.xoetrope.awt.XTabPanel;
19: import java.awt.Color;
20: import net.xoetrope.awt.XLabel;
21: import java.awt.event.MouseEvent;
22: import java.awt.Component;
23:
24: /**
25: * <p>Title: Xui</p>
26: * <p>Description: </p>
27: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
28: * <p>Company: Xoetrope Ltd.</p>
29: * @author not attributable
30: * @version 1.0
31: */
32: public class TabSample extends XPage {
33: XButton closeButton, saveButton;
34: Frame frame;
35: BuddyHelper buddy;
36: private boolean pageValidation = false;
37: private String validationText = "";
38: private XDataSource modelDataSource;
39:
40: public TabSample() {
41: buddy = new BuddyHelper((XStyleFactory) componentFactory);
42:
43: XProjectManager.getStyleManager().load("testtablestyles.xml");
44: frame = new Frame("Validation Sample");
45: frame.setLayout(null);
46: frame.setSize(640, 580);
47: String desc = "This example shows how to use a tab control";
48:
49: componentFactory.addComponent(XPage.LABEL, 10, 50, 530, 80,
50: desc);
51: XTabPanel tabs = (XTabPanel) componentFactory.addComponent(
52: XPage.TABPANEL, 10, 140, 530, 200, desc);
53: tabs.setDrawFrame(1);
54:
55: tabs.addTab("red", new XButton());
56: tabs.addTab("green", new XLabel());
57: tabs.addTab("blue", new XComboBox());
58: tabs.setBackgroundAt(0, Color.red);
59: tabs.setBackgroundAt(1, Color.green);
60: tabs.setBackgroundAt(2, Color.blue);
61: tabs.doLayout();
62:
63: mapEvents();
64:
65: frame.add(this );
66: frame.setVisible(true);
67: frame.show();
68: }
69:
70: private void mapEvents() {
71: addMouseHandler(closeButton, "Close");
72: }
73:
74: public static void main(String args[]) {
75: TabSample compSample = new TabSample();
76: }
77:
78: public void Close() {
79: if (wasMouseClicked()) {
80: frame.setVisible(false);
81: }
82: }
83:
84: }
|