i'm developing a java application with a main Panel in which i add a JDesktopPane
.
users clicking on JButton
, will show a JInternalFrame
. My problem is that if i use Mac OSx look and feel, the JDesktopPane
shows with correct size the JInternalFrame
, if i use other look and feel, it will display JInternalFrame
in the dimension of screen. This is what i do:
In main JPanel
:
jDesktopPane1 = new JDesktopPane();
setContentPane(jDesktopPane1);
when users click JButton(s)
:
public void addInDesktop(JInternalFrame frame){
frame.setVisible(true);
try {
jDesktopPane1.setSize(frame.getSize());
jDesktopPane1.setPreferredSize((frame.getSize()));
System.out.println(frame.getSize().toString());
System.out.println(jDesktopPane1.getSize().toString());
jDesktopPane1.add(frame);
frame.moveToFront();
frame.setSelected(true);
} catch (PropertyVetoException e) {
e.printStackTrace();
}
}
The System.out.println
says me that the dimension of JDesktopPane and JInternalFrame is the same, but why it show me the JInternalFrame in full screen size?