Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wrldwzrd89

macrumors G5
Original poster
Jun 6, 2003
12,110
77
Solon, OH
I want to create a dialog that looks and behaves like a JOptionPane, but also changes its icon based on what the user selected in the input dialog. I only care about the input dialog case - the other types of JOptionPanes don't need variable/dynamic icons. Is this possible? I haven't found a way to do this yet.

I did, however, manage to build a custom JFrame with a default button, a cancel button (pressing Escape when focus isn't on the JComboBox closes the JFrame, as it should), and the desired behavior. I just can't figure out how to make it look better - or is there a better solution, say, involving extending JOptionPane?
 
An update: I managed to figure out that the best way to do what I want is to add an ActionListener to the JComboBox the JOptionPane uses to display options... but, try as I might, the JOptionPane doesn't give me direct (or even indirect) access to that portion. Oh well... :(
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.