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 -
Shocked by the Title of this post, but the problem 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.
Fig 1. I have created a form, with the above 6 components; 2 JComboBoxes, 2 JLabels, 1 JProgressBar and 1 JTextArea
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.
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.
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.
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.
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.
This blog has been contributed to NetBeans Community Docs Program and for latest updates on this content, refer to the contribution.