Java Reference
In-Depth Information
private void selectDatabase(){
database = JOptionPane.showInputDialog(this,
"Database:","Select database",
JOptionPane.QUESTION_MESSAGE);
dbUtils = new DatabaseUtilities();
dbUtils.setExceptionListener(new ExceptionListener());
tableMenu.enableMenuItem("New Table",true);
tableMenu.enableMenuItem("Drop Table",true);
editMenu.enableMenuItem("Insert",true);
editMenu.enableMenuItem("Update",true);
editMenu.enableMenuItem("Delete",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){
Search WWH ::




Custom Search