Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

intercepting return from JOptionPane

 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
I'm using a JList in a JOptionPane to get some input from the user. When I call JOptionPane.showOptionDialog(), it will return an int indicating the result (i.e., whether the user clicked OK or CANCEL, etc.).
My question is, I would like to be able to check the user input BEFORE the JOptionPane disappears. For example, if the user clicked the OK button but did NOT select an item from the JList, I would like to use a beep to alert them and keep the JOptionPane up until the user either selects a value or clicks CANCEL.
Does anyone know a way to achieve this?
Thanks!
Stephanie
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a situation that requires a custom dialog. JOptionPane is great for generic functionality in message boxes, but if you have to do any custom handling, you will probably have to create a custom dialog box to do it.
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Bodie!
I'll look into that.
Stephanie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic