home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Sample.bin / JdbcConfigurationDialog.java < prev    next >
Text File  |  1998-09-27  |  6KB  |  166 lines

  1. /*
  2.         A basic implementation of the JDialog class.
  3. */
  4.  
  5. import com.sun.java.swing.*;
  6. import java.awt.*;
  7.  
  8. public class JdbcConfigurationDialog extends com.sun.java.swing.JDialog
  9. {
  10.     public JdbcConfigurationDialog()
  11.     {
  12.         this(null, false);    
  13.     }
  14.     public JdbcConfigurationDialog(Frame parent, boolean modal)
  15.     {
  16.         super(parent, modal);
  17.         // This code is automatically generated by Visual Cafe when you add
  18.         // components to the visual environment. It instantiates and initializes
  19.         // the components. To modify the code, only use code syntax that matches
  20.         // what Visual Cafe can generate, or Visual Cafe may be unable to back
  21.         // parse your Java file into its visual environment.
  22.         //{{INIT_CONTROLS
  23.         setTitle("Connection Information");
  24.         setDefaultCloseOperation(com.sun.java.swing.JFrame.DISPOSE_ON_CLOSE);
  25.         GridBagLayout gridBagLayout;
  26.         gridBagLayout = new GridBagLayout();
  27.         getContentPane().setLayout(gridBagLayout);
  28.         getContentPane().setBackground(java.awt.Color.lightGray);
  29.         getContentPane().setFont(new Font("Dialog", Font.PLAIN, 0));
  30.         setSize(372,185);
  31.         setVisible(false);
  32.         JLabel1.setText("User Name:");
  33.         JLabel1.setDisplayedMnemonic((int)'U');
  34.         JLabel1.setLabelFor(user);
  35.         getContentPane().add(JLabel1, new com.symantec.itools.awt.GridBagConstraintsD(0,0,1,1,0.0,0.0,java.awt.GridBagConstraints.EAST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,5),0,0));
  36.         JLabel1.setBounds(27,32,66,15);
  37.         user.setColumns(24);
  38.         getContentPane().add(user, new com.symantec.itools.awt.GridBagConstraintsD(1,0,1,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  39.         user.setBounds(98,30,264,19);
  40.         JLabel2.setText("Password:");
  41.         JLabel2.setDisplayedMnemonic((int)'P');
  42.         JLabel2.setLabelFor(password);
  43.         getContentPane().add(JLabel2, new com.symantec.itools.awt.GridBagConstraintsD(0,1,1,1,0.0,0.0,java.awt.GridBagConstraints.EAST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,5),0,0));
  44.         JLabel2.setBounds(32,51,61,15);
  45.         password.setColumns(24);
  46.         getContentPane().add(password, new com.symantec.itools.awt.GridBagConstraintsD(1,1,1,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  47.         password.setBounds(98,49,264,19);
  48.         JLabel3.setText("Database URL:");
  49.         JLabel3.setDisplayedMnemonic((int)'D');
  50.         JLabel3.setLabelFor(url);
  51.         getContentPane().add(JLabel3, new com.symantec.itools.awt.GridBagConstraintsD(0,2,1,1,0.0,0.0,java.awt.GridBagConstraints.EAST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,5),0,0));
  52.         JLabel3.setBounds(10,70,83,15);
  53.         url.setColumns(24);
  54.         getContentPane().add(url, new com.symantec.itools.awt.GridBagConstraintsD(1,2,1,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  55.         url.setBounds(98,68,264,19);
  56.         JLabel4.setText("Driver Class:");
  57.         JLabel4.setDisplayedMnemonic((int)'R');
  58.         JLabel4.setLabelFor(driver);
  59.         getContentPane().add(JLabel4, new com.symantec.itools.awt.GridBagConstraintsD(0,3,1,1,0.0,0.0,java.awt.GridBagConstraints.EAST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,5),0,0));
  60.         JLabel4.setBounds(21,89,72,15);
  61.         driver.setColumns(24);
  62.         getContentPane().add(driver, new com.symantec.itools.awt.GridBagConstraintsD(1,3,1,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  63.         driver.setBounds(98,87,264,19);
  64.         JLabel5.setText("Query:");
  65.         JLabel5.setDisplayedMnemonic((int)'Q');
  66.         JLabel5.setLabelFor(query);
  67.         getContentPane().add(JLabel5, new com.symantec.itools.awt.GridBagConstraintsD(0,4,1,1,0.0,0.0,java.awt.GridBagConstraints.EAST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,5),0,0));
  68.         JLabel5.setBounds(56,108,37,15);
  69.         query.setColumns(24);
  70.         getContentPane().add(query, new com.symantec.itools.awt.GridBagConstraintsD(1,4,1,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  71.         query.setBounds(98,106,264,19);
  72.         connect.setText("Connect");
  73.         connect.setMnemonic((int)'C');
  74.         getContentPane().add(connect, new com.symantec.itools.awt.GridBagConstraintsD(0,5,2,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(5,0,0,0),0,0));
  75.         connect.setBounds(145,130,81,25);
  76.         //}}
  77.  
  78.         //{{REGISTER_LISTENERS
  79.         SymAction lSymAction = new SymAction();
  80.         connect.addActionListener(lSymAction);
  81.         //}}
  82.     }
  83.     
  84.     public void setUser(String name)
  85.     {
  86.         user.setText(name);
  87.     }
  88.     public String getUser()
  89.     {
  90.         return user.getText();
  91.     }
  92.     
  93.     public void setPassword(String pass)
  94.     {
  95.         password.setText(pass);
  96.     }
  97.     public String getPassword()
  98.     {
  99.         return password.getText();
  100.     }
  101.     
  102.     public void setURL(String theURL)
  103.     {
  104.         url.setText(theURL);
  105.     }
  106.     public String getURL()
  107.     {
  108.         return url.getText();
  109.     }
  110.     
  111.     public void setDriver(String theDriver)
  112.     {
  113.         driver.setText(theDriver);
  114.     }
  115.     public String getDriver()
  116.     {
  117.         return driver.getText();
  118.     }
  119.     
  120.     public void setQuery(String theQuery)
  121.     {
  122.         query.setText(theQuery);
  123.     }
  124.     public String getQuery()
  125.     {
  126.         return query.getText();
  127.     }
  128.     
  129.     boolean wasCanceled=true;
  130.     
  131.     public boolean wasCanceled()
  132.     {
  133.         return wasCanceled;
  134.     }
  135.  
  136.     //{{DECLARE_CONTROLS
  137.     com.sun.java.swing.JLabel JLabel1 = new com.sun.java.swing.JLabel();
  138.     com.sun.java.swing.JTextField user = new com.sun.java.swing.JTextField();
  139.     com.sun.java.swing.JLabel JLabel2 = new com.sun.java.swing.JLabel();
  140.     com.sun.java.swing.JPasswordField password = new com.sun.java.swing.JPasswordField();
  141.     com.sun.java.swing.JLabel JLabel3 = new com.sun.java.swing.JLabel();
  142.     com.sun.java.swing.JTextField url = new com.sun.java.swing.JTextField();
  143.     com.sun.java.swing.JLabel JLabel4 = new com.sun.java.swing.JLabel();
  144.     com.sun.java.swing.JTextField driver = new com.sun.java.swing.JTextField();
  145.     com.sun.java.swing.JLabel JLabel5 = new com.sun.java.swing.JLabel();
  146.     com.sun.java.swing.JTextField query = new com.sun.java.swing.JTextField();
  147.     com.sun.java.swing.JButton connect = new com.sun.java.swing.JButton();
  148.     //}}
  149.  
  150.  
  151.     class SymAction implements java.awt.event.ActionListener
  152.     {
  153.         public void actionPerformed(java.awt.event.ActionEvent event)
  154.         {
  155.             Object object = event.getSource();
  156.             if (object == connect)
  157.                 connect_actionPerformed(event);
  158.         }
  159.     }
  160.  
  161.     void connect_actionPerformed(java.awt.event.ActionEvent event)
  162.     {
  163.         wasCanceled=false;
  164.         dispose();
  165.     }
  166. }