Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JOptionPane.showOptionDialog 2

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
GB
Just wondered if it was possible to add JComponents (i.e. JRadioButtons or JCheckBoxes specifically) to an option dialog. I've used the Object class to create bog-standard buttons on the option dialog but i want to customize it more than this!

:)
 
Absolutely. Just substitute the message with your Component. I would suggest you use something like a JPanel, and place the JRadioButtons, etc on that.

JPanel p = new JPanel();
p.setBackground(Color.green);
p.add(new JRadioButton("A Radio Button"));
JOptionPane.showMessageDialog(null, p, "title", JOptionPane.ERROR_MESSAGE);

 
It worked a treat!
Thank you very much - I really appreciate ur help. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top