Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JOptionPane custom buttons

843804Nov 17 2004 — edited Nov 17 2004
Hi, I want to create a JOptionPane with two buttons (ok, cancel), these buttons are completely customized with an own class extending JButton. I manage to create the JOptionPane so that it looks allright, but pushing the buttons does nothing. The only way to dispose the dialog is to close the window. Anyone know why?

My code looks like this
static boolean showConfirmDialog(String title, String text) {
	KButton[] buttons = new KButton[] {new KButton("ok"), new KButton("cancel")};
	JOptionPane pane = new JOptionPane(text, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, buttons, buttons[0]);
	JDialog dialog = pane.createDialog(contentPanel, title);
	dialog.show();
	System.out.println("" + pane.getValue());
	return true;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2004
Added on Nov 17 2004
5 comments
1,280 views