I am trying to get the maximum size of a JInternalFrame when it starts. I did a web search on this and tried various code suggestions, but they don't seem to work properly on my machine, which runs Java 6 on Windows 7.
I simplified the code below to make it easier to isolate the solution.
Can someone show me how to modify the code below so that the inner frame automatically expands when it is created?
import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLayeredPane; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.KeyStroke; public class MaximizeInternalFrame extends JFrame implements ActionListener{ private static final long serialVersionUID = 1L; JLayeredPane desktop; JInternalFrame internalFrame; public MaximizeInternalFrame() { super("Test To Maximize Internal Frame"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
source share