I need create custom dialog and put 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...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.