home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Button;
- import java.awt.Checkbox;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.Insets;
- import java.awt.Label;
- import java.awt.TextField;
-
- public class AutoDialog {
- Container m_Parent;
- boolean m_fInitialized;
- DialogLayout m_Layout;
- Button IDOK;
- Button IDCANCEL;
- TextField IDC_EDIT1;
- TextField IDC_EDIT2;
- Label IDC_STATIC1;
- Label IDC_STATIC2;
- Checkbox IDC_CHECK1;
-
- public boolean CreateControls() {
- if (!this.m_fInitialized && this.m_Parent != null) {
- if (!(this.m_Parent instanceof Container)) {
- return false;
- } else {
- Font OldFnt = this.m_Parent.getFont();
- if (OldFnt != null) {
- Font NewFnt = new Font(OldFnt.getName(), OldFnt.getStyle(), 14);
- this.m_Parent.setFont(NewFnt);
- }
-
- this.m_Layout = new DialogLayout(this.m_Parent, 186, 79);
- this.m_Parent.setLayout(this.m_Layout);
- this.m_Parent.addNotify();
- Dimension size = this.m_Layout.getDialogSize();
- Insets insets = this.m_Parent.insets();
- this.m_Parent.resize(insets.left + size.width + insets.right, insets.top + size.height + insets.bottom);
- this.IDOK = new Button("OK");
- this.m_Parent.add(this.IDOK);
- this.m_Layout.setShape(this.IDOK, 129, 7, 50, 14);
- this.IDCANCEL = new Button("Cancel");
- this.m_Parent.add(this.IDCANCEL);
- this.m_Layout.setShape(this.IDCANCEL, 129, 24, 50, 14);
- this.IDC_EDIT1 = new TextField("");
- this.m_Parent.add(this.IDC_EDIT1);
- this.m_Layout.setShape(this.IDC_EDIT1, 58, 13, 62, 14);
- this.IDC_EDIT2 = new TextField("");
- this.m_Parent.add(this.IDC_EDIT2);
- this.m_Layout.setShape(this.IDC_EDIT2, 58, 35, 62, 14);
- this.IDC_STATIC1 = new Label("First Name:", 0);
- this.m_Parent.add(this.IDC_STATIC1);
- this.m_Layout.setShape(this.IDC_STATIC1, 13, 13, 41, 8);
- this.IDC_STATIC2 = new Label("Last Name:", 0);
- this.m_Parent.add(this.IDC_STATIC2);
- this.m_Layout.setShape(this.IDC_STATIC2, 13, 37, 40, 8);
- this.IDC_CHECK1 = new Checkbox("Married");
- this.m_Parent.add(this.IDC_CHECK1);
- this.m_Layout.setShape(this.IDC_CHECK1, 59, 55, 39, 10);
- this.m_fInitialized = true;
- return true;
- }
- } else {
- return false;
- }
- }
-
- public AutoDialog(Container parent) {
- this.m_Parent = parent;
- }
- }
-