Search code examples
javaswingframejinternalframe

May i can use JOptionPane.showConfirmDialog for dispay JInternalFrame?


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?


Solution

  • 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.