01: package net.xoetrope.samples.controls;
02:
03: import javax.swing.JFrame;
04:
05: import net.xoetrope.swing.XButton;
06: import net.xoetrope.data.XDataSource;
07: import net.xoetrope.swing.XSplitPane;
08: import net.xoetrope.xui.XPage;
09: import net.xoetrope.xui.XProjectManager;
10: import net.xoetrope.xui.helper.BuddyHelper;
11: import net.xoetrope.xui.style.XStyleFactory;
12:
13: /**
14: * A simple demo/test of the XSplitPane class
15: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
16: * $Revision: 1.1 $
17: */
18: public class SplitPaneSample extends XPage {
19: XButton closeButton, saveButton;
20: JFrame frame;
21: BuddyHelper buddy;
22: private boolean pageValidation = false;
23: private String validationText = "";
24: private XDataSource modelDataSource;
25:
26: public SplitPaneSample() {
27: buddy = new BuddyHelper((XStyleFactory) componentFactory);
28:
29: XProjectManager.getStyleManager().load("testtablestyles.xml");
30: String desc = "This example shows how to use a split pane control";
31:
32: componentFactory.setParentComponent(this );
33: componentFactory.addComponent(XPage.LABEL, 10, 50, 530, 80,
34: desc);
35: XSplitPane splitter = (XSplitPane) componentFactory
36: .addComponent(XPage.SPLITPANE, 10, 140, 530, 200, desc);
37: splitter.setAttribute("orientation", "vert");
38: splitter.setAttribute("size", "6");
39:
40: componentFactory.setParentComponent(splitter);
41: XButton topBtn = (XButton) componentFactory.addComponent(
42: XPage.BUTTON, 100, 100, 300, 100, "top");
43: XButton bottomBtn = (XButton) componentFactory.addComponent(
44: XPage.BUTTON, 100, 100, 300, 100, "bottom");
45:
46: splitter.doLayout();
47:
48: mapEvents();
49: }
50:
51: private void mapEvents() {
52: addMouseHandler(closeButton, "Close");
53: }
54:
55: public void Close() {
56: if (wasMouseClicked()) {
57: frame.setVisible(false);
58: }
59: }
60: }
|