• Post Reply Bookmark Topic Watch Topic
  • New Topic

Event handling with JOptionPane

 
Ben Hultin
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to make a JOptionPane produce another one based on its button click and what is fond in the text field by the user.

I am not getting any compiler errors.

I have tried these methods:







the .equals("OK") refers to a JButton found in a JFrame... it works fine

I have not yet put in the other condition to check the string for a match. Just trying to get this working first.

The JOptionPane's object variables have been initialized as:

option1, option2, option3, etc.

inPut1 and inPut2 have been declared as private strings in the class.


Thanks for the help
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the first rule of debugging:

System.out.println(event.getActionCommand());

see what it actually produces, then work from that
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!