Java Reference
In-Depth Information
dbUtils.setExceptionListener(new ExceptionListener());
tableMenu.enableMenuItem("New Table",true);
tableMenu.enableMenuItem("Drop Table",true);
}
private void executeSQLCommand(String SQLCommand){
dbUtils.execute(SQLCommand);
}
private void dropTable(){
tableName = JOptionPane.showInputDialog(this,"Table:",
"Select table",JOptionPane.QUESTION_MESSAGE);
int option = JOptionPane.showConfirmDialog(null,
"Dropping table "+tableName,
"Database "+database,
JOptionPane.OK_CANCEL_OPTION);
if(option==0){
executeSQLCommand("DROP TABLE "+tableName);
}
}
class MenuListener implements ActionListener{
public void actionPerformed(ActionEvent event){
String menuSelection = event.getActionCommand();
if(menuSelection.equals("Database")){
selectDatabase();
}else if(menuSelection.equals("New Table")){
displayTableBuilderFrame();
}else if(menuSelection.equals("Drop Table")){
dropTable();
}else if(menuSelection.equals("Exit")){
System.exit(0);
}
Search WWH ::




Custom Search