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.
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.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With