home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-09-10 | 7.8 KB | 249 lines |
- //------------------------------------------------------------------------------
- // NewCtrls.java:
- // Implementation for container control initialization class NewCtrls
- //
- // WARNING: Do not modify this file. This file is recreated each time its
- // associated .rct/.res file is sent through the Java Resource Wizard!
- //
- // This class can be use to create controls within any container, however, the
- // following describes how to use this class with an Applet. For addtional
- // information on using Java Resource Wizard generated classes, refer to the
- // Visual J++ 1.1 documention.
- //
- // 1) Import this class in the .java file for the Applet that will use it:
- //
- // import NewCtrls;
- //
- // 2) Create an instance of this class in your Applet's 'init' member, and call
- // CreateControls() through this object:
- //
- // NewCtrls ctrls = new NewCtrls (this);
- // ctrls.CreateControls();
- //
- // 3) To process events generated from user action on these controls, implement
- // the 'handleEvent' member for your applet:
- //
- // public boolean handleEvent (Event evt)
- // {
- //
- // }
- //
- //------------------------------------------------------------------------------
- import java.awt.*;
- import DLayout;
-
- public class NewCtrls
- {
- Container m_Parent = null;
- boolean m_fInitialized = false;
- DLayout m_Layout;
-
- // Control definitions
- //--------------------------------------------------------------------------
- Button btnCreate;
- Button btnCancel;
- Label IDC_STATIC1;
- TextField tfConfName;
- Label IDC_STATIC2;
- TextArea taDesc;
- Label IDC_STATIC3;
- TextField tfUserName;
- Label IDC_STATIC4;
- Choice cmbStartMonth;
- TextField tfStartDay;
- TextField tfStartYear;
- Label IDC_STATIC5;
- Label IDC_STATIC6;
- Label IDC_STATIC7;
- Label IDC_STATIC8;
- Label IDC_STATIC9;
- Label IDC_STATIC10;
- TextField tfStopHour;
- TextField tfStopMinute;
- Label IDC_STATIC11;
- Label IDC_STATIC12;
- TextField tfStartHour;
- TextField tfStartMinute;
- Label IDC_STATIC13;
- Label IDC_STATIC14;
- Label IDC_STATIC15;
- TextField tfStopYear;
- TextField tfStopDay;
- Choice cmbStopMonth;
-
-
- // Constructor
- //--------------------------------------------------------------------------
- public NewCtrls (Container parent)
- {
- m_Parent = parent;
- }
-
- // Initialization.
- //--------------------------------------------------------------------------
- public boolean CreateControls()
- {
- // Can only init controls once
- //----------------------------------------------------------------------
- if (m_fInitialized || m_Parent == null)
- return false;
-
- // Parent must be a derivation of the Container class
- //----------------------------------------------------------------------
- if (!(m_Parent instanceof Container))
- return false;
-
- // Since there is no way to know if a given font is supported from
- // platform to platform, we only change the size of the font, and not
- // type face name. And, we only change the font if the dialog resource
- // specified a font.
- //----------------------------------------------------------------------
- Font OldFnt = m_Parent.getFont();
-
- if (OldFnt != null)
- {
- Font NewFnt = new Font(OldFnt.getName(), OldFnt.getStyle(), 8);
-
- m_Parent.setFont(NewFnt);
- }
-
- // All position and sizes are in Dialog Units, so, we use the
- // DLayout manager.
- //----------------------------------------------------------------------
- m_Layout = new DLayout(m_Parent, 344, 143);
- m_Parent.setLayout(m_Layout);
- m_Parent.addNotify();
-
- Dimension size = m_Layout.getDialogSize();
- Insets insets = m_Parent.insets();
-
- m_Parent.resize(insets.left + size.width + insets.right,
- insets.top + size.height + insets.bottom);
-
- // Control creation
- //----------------------------------------------------------------------
- btnCreate = new Button ("Create");
- m_Parent.add(btnCreate);
- m_Layout.setShape(btnCreate, 118, 122, 50, 14);
-
- btnCancel = new Button ("Cancel");
- m_Parent.add(btnCancel);
- m_Layout.setShape(btnCancel, 174, 122, 50, 14);
-
- IDC_STATIC1 = new Label ("Conference Name:", Label.LEFT);
- m_Parent.add(IDC_STATIC1);
- m_Layout.setShape(IDC_STATIC1, 7, 7, 60, 8);
-
- tfConfName = new TextField ("");
- m_Parent.add(tfConfName);
- m_Layout.setShape(tfConfName, 7, 17, 160, 13);
-
- IDC_STATIC2 = new Label ("Description:", Label.LEFT);
- m_Parent.add(IDC_STATIC2);
- m_Layout.setShape(IDC_STATIC2, 7, 37, 38, 8);
-
- taDesc = new TextArea ("");
- m_Parent.add(taDesc);
- m_Layout.setShape(taDesc, 7, 47, 160, 65);
-
- IDC_STATIC3 = new Label ("User Name:", Label.LEFT);
- m_Parent.add(IDC_STATIC3);
- m_Layout.setShape(IDC_STATIC3, 177, 7, 38, 8);
-
- tfUserName = new TextField ("");
- m_Parent.add(tfUserName);
- m_Layout.setShape(tfUserName, 177, 17, 160, 13);
-
- IDC_STATIC4 = new Label ("Month:", Label.LEFT);
- m_Parent.add(IDC_STATIC4);
- m_Layout.setShape(IDC_STATIC4, 177, 47, 23, 8);
-
- cmbStartMonth = new Choice ();
- m_Parent.add(cmbStartMonth);
- m_Layout.setShape(cmbStartMonth, 177, 57, 60, 65);
-
- tfStartDay = new TextField ("");
- m_Parent.add(tfStartDay);
- m_Layout.setShape(tfStartDay, 242, 57, 20, 13);
-
- tfStartYear = new TextField ("");
- m_Parent.add(tfStartYear);
- m_Layout.setShape(tfStartYear, 267, 57, 25, 13);
-
- IDC_STATIC5 = new Label ("Day:", Label.LEFT);
- m_Parent.add(IDC_STATIC5);
- m_Layout.setShape(IDC_STATIC5, 242, 47, 16, 8);
-
- IDC_STATIC6 = new Label ("Year:", Label.LEFT);
- m_Parent.add(IDC_STATIC6);
- m_Layout.setShape(IDC_STATIC6, 267, 47, 18, 8);
-
- IDC_STATIC7 = new Label ("Start Time:", Label.LEFT);
- m_Parent.add(IDC_STATIC7);
- m_Layout.setShape(IDC_STATIC7, 177, 37, 35, 8);
-
- IDC_STATIC8 = new Label ("Stop Time:", Label.LEFT);
- m_Parent.add(IDC_STATIC8);
- m_Layout.setShape(IDC_STATIC8, 177, 77, 35, 8);
-
- IDC_STATIC9 = new Label ("Hr:", Label.LEFT);
- m_Parent.add(IDC_STATIC9);
- m_Layout.setShape(IDC_STATIC9, 297, 87, 10, 8);
-
- IDC_STATIC10 = new Label ("Min:", Label.LEFT);
- m_Parent.add(IDC_STATIC10);
- m_Layout.setShape(IDC_STATIC10, 322, 87, 14, 8);
-
- tfStopHour = new TextField ("");
- m_Parent.add(tfStopHour);
- m_Layout.setShape(tfStopHour, 297, 97, 20, 13);
-
- tfStopMinute = new TextField ("");
- m_Parent.add(tfStopMinute);
- m_Layout.setShape(tfStopMinute, 322, 97, 15, 13);
-
- IDC_STATIC11 = new Label ("Hr:", Label.LEFT);
- m_Parent.add(IDC_STATIC11);
- m_Layout.setShape(IDC_STATIC11, 297, 47, 10, 8);
-
- IDC_STATIC12 = new Label ("Min:", Label.LEFT);
- m_Parent.add(IDC_STATIC12);
- m_Layout.setShape(IDC_STATIC12, 322, 47, 14, 8);
-
- tfStartHour = new TextField ("");
- m_Parent.add(tfStartHour);
- m_Layout.setShape(tfStartHour, 297, 57, 20, 13);
-
- tfStartMinute = new TextField ("");
- m_Parent.add(tfStartMinute);
- m_Layout.setShape(tfStartMinute, 322, 57, 15, 13);
-
- IDC_STATIC13 = new Label ("Month:", Label.LEFT);
- m_Parent.add(IDC_STATIC13);
- m_Layout.setShape(IDC_STATIC13, 177, 87, 23, 8);
-
- IDC_STATIC14 = new Label ("Day:", Label.LEFT);
- m_Parent.add(IDC_STATIC14);
- m_Layout.setShape(IDC_STATIC14, 242, 87, 16, 8);
-
- IDC_STATIC15 = new Label ("Year:", Label.LEFT);
- m_Parent.add(IDC_STATIC15);
- m_Layout.setShape(IDC_STATIC15, 267, 87, 18, 8);
-
- tfStopYear = new TextField ("");
- m_Parent.add(tfStopYear);
- m_Layout.setShape(tfStopYear, 267, 97, 25, 13);
-
- tfStopDay = new TextField ("");
- m_Parent.add(tfStopDay);
- m_Layout.setShape(tfStopDay, 242, 97, 20, 13);
-
- cmbStopMonth = new Choice ();
- m_Parent.add(cmbStopMonth);
- m_Layout.setShape(cmbStopMonth, 177, 97, 60, 65);
-
- m_fInitialized = true;
- return true;
- }
- }
-