May i can use JOptionPane.showConfirmDialog for di

2019-04-12 21:30发布

问题:

May i can use JOptionPane.showConfirmDialog for display JInternalFrame?

I tried following code:

OPD.Registration opdRegister = new OPD.Registration(); 
//OPD.Registration is extending JInternalFrame    

int ns=JOptionPane.showConfirmDialog(null, opdRegister, "Billing", JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE);
// i am trying to call opdregister in this Confirm Dialog Box.

By using above code that display dialog box with JInternalFrame but it not display proper. It display only title bar. Other data are cut from the JInternalFrame.

How can I increase size of this dialog?

回答1:

Yes, although a JInternalFrame is intended for use in a JDesktopPane. If you're seeing only the title bar, verify that your content has a preferred size and pack() the internal frame, as shown here.