/* A basic implementation of the JDialog class. */ package SesameGUI; import java.awt.*; import javax.swing.*; public class JDialogSiteName extends javax.swing.JDialog { public boolean OK = false; public JDialogSiteName(Frame parent) { super(parent); // This code is automatically generated by Visual Cafe when you add // components to the visual environment. It instantiates and initializes // the components. To modify the code, only use code syntax that matches // what Visual Cafe can generate, or Visual Cafe may be unable to back // parse your Java file into its visual environment. //{{INIT_CONTROLS setTitle("Enter Site Name"); getContentPane().setLayout(null); setSize(457,200); setVisible(false); getContentPane().add(JEditSiteName); JEditSiteName.setBounds(132,48,312,24); JLabel1.setText("Site Name:"); getContentPane().add(JLabel1); JLabel1.setBounds(24,48,108,24); JButtonOK.setText("OK"); getContentPane().add(JButtonOK); JButtonOK.setBounds(24,132,132,24); JButtonCancel.setText("Cancel"); getContentPane().add(JButtonCancel); JButtonCancel.setBounds(288,132,132,24); //}} //{{REGISTER_LISTENERS SymAction lSymAction = new SymAction(); JButtonOK.addActionListener(lSymAction); JButtonCancel.addActionListener(lSymAction); //}} } public JDialogSiteName() { this((Frame)null); } public JDialogSiteName(Frame frame,boolean modal) { this(frame); this.setModal(modal); } public JDialogSiteName(String sTitle) { this(); setTitle(sTitle); } public void setVisible(boolean b) { if (b) setLocation(50, 50); super.setVisible(b); } static public void main(String args[]) { (new JDialogSiteName()).setVisible(true); } public void addNotify() { // Record the size of the window prior to calling parents addNotify. Dimension size = getSize(); super.addNotify(); if (frameSizeAdjusted) return; frameSizeAdjusted = true; // Adjust size of frame according to the insets Insets insets = getInsets(); setSize(insets.left + insets.right + size.width, insets.top + insets.bottom + size.height); } // Used by addNotify boolean frameSizeAdjusted = false; //{{DECLARE_CONTROLS javax.swing.JTextField JEditSiteName = new javax.swing.JTextField(); javax.swing.JLabel JLabel1 = new javax.swing.JLabel(); javax.swing.JButton JButtonOK = new javax.swing.JButton(); javax.swing.JButton JButtonCancel = new javax.swing.JButton(); //}} class SymAction implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if (object == JButtonOK) JButtonOK_actionPerformed(event); else if (object == JButtonCancel) JButtonCancel_actionPerformed(event); } } void JButtonOK_actionPerformed(java.awt.event.ActionEvent event) { // OK setVisible(false); OK = true; } void JButtonCancel_actionPerformed(java.awt.event.ActionEvent event) { // Cancel setVisible(false); OK = false; } }