how to put jpanel into a dialog box?
I need create custom dialog and 开发者_如何学Goput JPanel into it. Is it possible?
Probably you need this,
JPanel myPanel = new JPanel();
myPanel.setBounds(0, 0, 400, 450);
myPanel.setBackground(Color.YELLOW);
JOptionPane jop = new JOptionPane();
JDialog dialog = jop.createDialog("This is my Dialog");
dialog.setSize(400, 450);
dialog.setContentPane(myPanel);
dialog.setVisible(true);
I have tested this code, and working fine for me...
Panel inside dialog box should have what you need.
精彩评论