Java Reference
In-Depth Information
}
}
class ExceptionListener implements ActionListener{
public void actionPerformed(ActionEvent event){
String exception = event.getActionCommand();
JOptionPane.showMessageDialog(null, exception,
"SQL Error", JOptionPane.ERROR_MESSAGE);
}
}
class CommandListener implements ActionListener{
public void actionPerformed(ActionEvent event){
String SQLCommand = event.getActionCommand();
executeSQLCommand(SQLCommand);
}
}
public static void main(String args[]){
DBManager dbm = new DBManager ();
}
}
View
The view is handled primarily by these two classes:
 
TableMenu .
 
TableBuilderFrame
TableMenu
TableMenu displays and handles inputs from a basic JMenu used to select a database and identify a
table. Being the first menu on the JMenuBar , the TableMenu also handles the Exit function.
TableMenu extends a simple base class DBMenu (see Listing 5-4 ), which provides common
functionality. The main purpose of DBMenu is to simplify menu creation and to provide a common point
for hooking an event listener into the menu items so that they do not have to be set up individually from
the controller.
Search WWH ::




Custom Search