01: package net.xoetrope.samples.controls;
02:
03: import java.awt.Frame;
04: import java.awt.ScrollPane;
05:
06: import net.xoetrope.awt.XButton;
07: import net.xoetrope.awt.XMetaContent;
08: import net.xoetrope.awt.XScrollPane;
09: import net.xoetrope.xui.XPage;
10: import net.xoetrope.xui.XProjectManager;
11:
12: /**
13: * <p>Title: Xui</p>
14: * <p>Description: </p>
15: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
16: * <p>Company: Xoetrope Ltd.</p>
17: * @author Xoetrope Ltd.
18: * @version 1.0
19: */
20: public class MetaSample extends XPage {
21: XButton closeButton;
22: Frame frame;
23: XMetaContent cont;
24: XScrollPane sp;
25:
26: public MetaSample() {
27: XProjectManager.getStyleManager().load("metastyle.xml");
28: frame = new Frame("MetaContent Sample");
29: frame.setLayout(null);
30: frame.setSize(640, 580);
31:
32: ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
33: sp.setBounds(10, 130, 300, 300);
34: sp.setVisible(true);
35: // sp.setLayout( null );
36: frame.add(sp);
37: this .componentFactory.setParentComponent(sp);
38: cont = (XMetaContent) componentFactory.addComponent(
39: XPage.METACONTENT, 10, 130, 300, 400, "metasample.xml");
40: // XImage img = new XImage();
41: // img.setImage( XResourceManager.getImage("DublinMap.gif"));
42: // img.setBounds(10, 130, 600, 800);
43: // sp.add( img );
44: // frame.setVisible(true);
45: frame.show();
46: }
47:
48: /*public MetaSample()
49: {
50: XProjectManager.getStyleManager().load( "metastyle.xml" );
51: frame = new Frame( "MetaContent Sample" );
52: frame.setLayout(null);
53: frame.setSize( 640, 580 );
54: String desc = "This example shows how the XMetaContent control works. Setup the styles using the XStyleManager";
55: desc += " and load the meta source from an xml formatted file.";
56:
57: componentFactory.setParentComponent( frame );
58: componentFactory.addComponent( XPage.XLABEL, 10, 50, 530, 80, desc );
59: closeButton = (XButton)componentFactory.addComponent( XBUTTON, 10, 540, 130, 25, "Close" );
60: // sp = (XScrollPane)componentFactory.addComponent( XSCROLLPANE, 10, 130, 300, 200 );
61: ScrollPane sp = new ScrollPane( ScrollPane.SCROLLBARS_ALWAYS );
62: sp.setBounds(10, 130, 300, 200);
63: sp.setVisible( true );
64: frame.add ( sp );
65: componentFactory.setParentComponent( sp );
66: cont = (XMetaContent)componentFactory.addComponent( XMETACONTENT, 10, 130, 300, 400, "metasample.xml" );
67:
68: this.addMouseHandler( closeButton, "Close" );
69: sp.doLayout();
70: frame.setVisible(true);
71: cont.setSize( 300, 400 );
72: frame.show();
73: }*/
74:
75: public static void main(String args[]) {
76: MetaSample compSample = new MetaSample();
77: }
78:
79: public void Close() {
80: // if ( wasMouseClicked() ){
81: // System.out.println( cont.getSize().height + ":" + sp.getSize().height );
82: // frame.setVisible( false );
83: // }
84: }
85:
86: }
|