mtrsykl
mtrsykl

Reputation: 31

How to open a pane in a JOptionPane?

HI i want to open a pane in a JOptionPane, i have buttons on the pane,

 PPane newPane = new PPane(); 
 int choose = JOptionPane.showConfirmDialog(this, newPane, "Message...",
 JOptionPane.PLAIN_MESSAGE);

now i can open my pane in a JOptionPane but there is a "ok" button, i dont want this, i just want open my pane,

or

Object[] options = { "OK", "CANCEL" };
JOptionPane.showOptionDialog(null, "Click OK to continue", "Warning",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);

if i dont put buttons on my pane, i open the JOptionPane with OK and Cancel button, now can i put my pane this??

Upvotes: 0

Views: 424

Answers (1)

Ludger
Ludger

Reputation: 1031

You can not put your pane in a JOptionpane dialog,

I would suggest rather writing your own JDialog and put your pane on there. You can still make your Dialog model by using the correct constructor:

public JDialog(Frame owner, boolean modal) 

Here is a small example of a custom Dialog:

http://darksleep.com/player/DialogExample/

Upvotes: 2

Related Questions