javaswingjinternalframejdesktoppane

Why the JInterFrame not resizing?


I am creating one java Application which includes the JDesktopPane and JInternalFrame.

And I am using GridLayOut to set JInternalFrame

The Issue is I can't resize the JInternalFrame as per the GridLayout size

Below is One Screen Shot of Application enter image description here

I want the JInnernalFrame as the grid size.

Please do help me.


Solution

  • Because JInternalFrames are suppose to be added to and managed by a JDesktopPane

    Take a look at How to Use Internal Frames for more details

    JDesktopPane isn't suppose to have a layout manager, the GridLayout is taking control and making decision about how the JInternalFrame should be managed.

    Simple answer is, don't use a layout manager with a JDesktopPane. Instead use JInternalFrame#pack to size the frames, setLocation to place it and don't forget to make it visible

    I want the JInnernalFrame as the grid size

    Either don't use JInternalFrames this way, or provide functionality that can mimic this when you want it. Layout managers tend to be to rigid for providing both these functionalities