home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
ExampleLauncher.java
< prev
next >
Wrap
Text File
|
1998-09-28
|
5KB
|
165 lines
/*
A basic implementation of the JFrame class.
*/
import com.sun.java.swing.*;
import java.awt.*;
public class ExampleLauncher extends com.sun.java.swing.JFrame
{
String driver=null;
String url=null;
String user=null;
String password=null;
String query=null;
public ExampleLauncher()
{
// 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("Select Table Example");
setDefaultCloseOperation(com.sun.java.swing.JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new BoxLayout(this.getContentPane(),BoxLayout.Y_AXIS));
getContentPane().setFont(new Font("Dialog", Font.PLAIN, 0));
setSize(164,138);
setVisible(false);
example1.setText("Example1");
example1.setActionCommand("Example1");
example1.setAlignmentX(0.5F);
getContentPane().add(example1);
example1.setBounds(36,0,91,25);
example2.setText("Example 2");
example2.setActionCommand("Example 2");
example2.setAlignmentX(0.5F);
getContentPane().add(example2);
example2.setBounds(35,25,93,25);
example3.setText("Example 3");
example3.setActionCommand("Example 3");
example3.setAlignmentX(0.5F);
getContentPane().add(example3);
example3.setBounds(35,50,93,25);
example4.setText("Example 4");
example4.setActionCommand("Example 4");
example4.setAlignmentX(0.5F);
getContentPane().add(example4);
example4.setBounds(35,75,93,25);
//}}
//{{INIT_MENUS
//}}
//{{REGISTER_LISTENERS
SymAction lSymAction = new SymAction();
example1.addActionListener(lSymAction);
example2.addActionListener(lSymAction);
example3.addActionListener(lSymAction);
example4.addActionListener(lSymAction);
//}}
}
static public void main(String args[])
{
ExampleLauncher e = new ExampleLauncher();
e.setLocation(50, 50);
e.setVisible(true);
}
//{{DECLARE_CONTROLS
com.sun.java.swing.JButton example1 = new com.sun.java.swing.JButton();
com.sun.java.swing.JButton example2 = new com.sun.java.swing.JButton();
com.sun.java.swing.JButton example3 = new com.sun.java.swing.JButton();
com.sun.java.swing.JButton example4 = new com.sun.java.swing.JButton();
//}}
//{{DECLARE_MENUS
//}}
void configDialog(SimpleJdbcTableModel tm)
{
JdbcConfigurationDialog config = new JdbcConfigurationDialog(this, true);
if(driver==null)
{
config.setDriver(tm.getJdbcDriverClass());
config.setURL(tm.getJdbcDriverURL());
config.setUser(tm.getUser());
config.setPassword(tm.getPassword());
config.setQuery(tm.getQuery());
}
else
{
config.setDriver(driver);
config.setURL(url);
config.setUser(user);
config.setPassword(password);
config.setQuery(query);
}
config.setVisible(true);
driver = config.getDriver();
url = config.getURL();
user = config.getUser();
password = config.getPassword();
query = config.getQuery();
tm.setJdbcDriverClass(driver);
tm.setJdbcDriverURL(url);
tm.setUser(user);
tm.setPassword(password);
tm.setQuery(query);
tm.doQuery();
}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == example1)
example1_actionPerformed(event);
else if (object == example2)
example2_actionPerformed(event);
else if (object == example3)
example3_actionPerformed(event);
else if (object == example4)
example4_actionPerformed(event);
}
}
void example1_actionPerformed(java.awt.event.ActionEvent event)
{
TableExample1 te = new TableExample1();
configDialog(te.simpleJdbcTableModel1);
te.setLocation(getLocation().x + 30, getLocation().y + 30);
te.setVisible(true);
dispose();
}
void example2_actionPerformed(java.awt.event.ActionEvent event)
{
TableExample2 te = new TableExample2();
configDialog(te.simpleJdbcTableModel1);
te.setLocation(getLocation().x + 30, getLocation().y + 30);
te.setVisible(true);
dispose();
}
void example3_actionPerformed(java.awt.event.ActionEvent event)
{
TableExample3 te = new TableExample3();
te.setLocation(getLocation().x + 30, getLocation().y + 30);
te.setVisible(true);
dispose();
}
void example4_actionPerformed(java.awt.event.ActionEvent event)
{
TableExample4 te = new TableExample4();
te.setLocation(getLocation().x + 30, getLocation().y + 30);
te.setVisible(true);
dispose();
}
}