Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable automatic component alignment in Netbeans?

Is there any way or plug-in that disables Netbeans automatic component alignment? When I place a label, all my components got placed randomly on the panel, not how I set them up. Every time I add a component the window gets re-sized or some component does.

like image 715
Bugster Avatar asked Dec 28 '11 18:12

Bugster


2 Answers

As a long-time NetBeans user (over 11 years now...geez, I'm getting old) and as someone who's worked exclusively in Swing for over half that time I think I'm qualified to give you the following advice:

Don't use a WYSIWYG UI editor.

Unless your whipping out a simple UI with a button and a text field for your own use you're better off in the short term (development) and the long term (maintainability) if you create your UIs by hand. It's not that hard if you do a little thinking beforehand.

The layout managers I've found to be most useful are BorderLayout, FlowLayout, GridLayout, and my particular favorite, BoxLayout (including the handy Box component).

While I haven't used it myself, I've heard good things about the MiG layout manager, which has a nice quite start guide.

If you have questions on using any of the layout managers that the many tutorials don't answer (overview of layout managers with links to tutorials) , just post them at SO.

like image 118
Paul Avatar answered Oct 04 '22 21:10

Paul


Choose a layout other than the default, GroupLayout. Better, do a few manually to get the idea, as suggested in A Visual Guide to Layout Managers.

Addendum: @Paul argues persuasively against using a GUI editor. While I tend to agree, I see two reasonable use cases:

  • For the novice: a convenient way to experiment with less familiar layouts.
  • For the experienced developer: a way to manage that one difficult layout that you just know will change, as suggested here.
like image 34
trashgod Avatar answered Oct 04 '22 22:10

trashgod