TaT ResizeComponentsInGUI

Tips & Tricks | Resizing Components In GUI Matisse Builder

[[{TableOfContentsTitle=TableOfContents} | {TableOfContents title='Table of Contents'}]]


Recently, a friend of mine encountered a problem with GUI Matisse Builder in NetBeans, he thought its some sort of a bug. However, when I saw it and looked for the solution, both of us were happy and I was glad it was not a bug!

Problem Description

The problem is concerned with a Editor Context Menu Item, named “Space Around Component…”.

When we launch an application which has certain Window Form’s, we might maximize/restore the window umpteen times. What if, on resizing that Window, some component gets relocated in an awkward position, disturbing the GUI.

Well, there lies a solution to this problem, just open the JFrame Form in NetBeans IDE, goto Design View and right-click the Form to get a Context Menu with a Menu Item mentioned above.

Now, I present to you certain screenshots that would enable you to solve this problem once in for all.

File:opened-jframe-form_TaT_ResizeComponentsInGUI.jpg Fig 1. I have created a form, with the above 6 components; 2 JComboBoxes, 2 JLabels, 1 JProgressBar and 1 JTextArea

File:preview-design_TaT_ResizeComponentsInGUI.jpg Fig 2. Tooltip shown above tells you to click on that button (see the button with an eye on it) to Preview Design, rather than launching the Application and testing the Window Form.

File:resized-jframe_TaT_ResizeComponentsInGUI.jpg Fig 3. This is the preview of that form, you can see the location of JProgressBar, its like that because I had already resized the Window after clicking on Preview Design.


File:resizing-components_TaT_ResizeComponentsInGUI.jpg Fig 4. Right-click the JFrame Form and Context Menu pops up and you can see the Menu Item, “Space Around Component…” click on it to do the rectification.

File:resizing-window_TaT_ResizeComponentsInGUI.jpg Fig 5. Here’s the window which lets you rectify the problem.

As you can see the location of JProgressbar, its located below JTextArea, so what I want whenever Window is resized, the space on the left and right sides should remain same.

File:preview-final_TaT_ResizeComponentsInGUI.jpg Fig 6. After doing necessary changes in that Spacing Window, I again saw the Preview, this time the problem was solved.

Similarly, all the components can be adjusted in a similar fashion, however just keep in mind one thing, that you should see the location of the component and its adjacent one’s too. Then, make suitable modifications.

Hope this helps, if it does, do comment on this post. Thanks for reading It.

eNjoy Technology…..


  1. taT "Space Around Component..."
  2. Dzone Links


Varun Nischal

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo