I'm trying to output a message dialog box as a result of an Action Listener in my program. I keep receiving an error that says 'Uncompilable source code - incompatible types: void cannot be converted to java.lang.String'. I can't figure out what I'm doing wrong, especially when I can get the Input dialog and Confirm dialog boxes to come up the way I want the Message dialog boxes to, using pretty much the same code. Here's the code I used...
//add an ActionListener for Search Menu Item
srch.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(database_name == null){
error = JOptionPane.showMessageDialog(null, "This is an Error Message", "Error", JOptionPane.ERROR_MESSAGE);
}
else if(database_name != null){
jta.setText("It works");
}//end if statement
}//end actionPerformed
});//end Search menuItem action listener