开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜