What java GUI layout manager does everyone use? Lately, I have been using MigLayout, which has some powerful component controls. Just wanted to see what other developers are using other than the standard JDK ones.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
I'm a bit of Java newbie.
I tried GridBagLayout, gave up, then tried BoxLayout, then gave up, then made my own Custom Layout which worked. With GridBag and Box I put my best guess in and the Layout engines decided to do something different, without any apparent way to debug them.
With my custom layout, I could print out coordinates and widths and heights, to find out where it was going wrong. Its a bit mathy placing things but you've got the full power of java to use rather than the limited vocabulary of one of the builtin layout managers.
Of course it was just for a home project, you'd never be allowed to do this at work.
I've always been a big fan of the GridBagLayout. It resembles HTML tables a lot so it is intuitive to those web programmers.
The last Swing application I worked on used JGoodies' FormsLayout.
As a general overview, you might find an article I wrote a loooong time ago at sun to be useful. It's not up to date with the latest layout managers, but it concentrates on effective nesting of layout managers, rather than trying to do everything with one layout.
See http://developer.java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr
GridBagLayout is usable. Once you get used to using it, it works great. I think the standard JDK layout managers are pretty powerful on their own. Plus, you get to minimize dependency on 3rd party libraries.
I use DesignGridLayout for most of my panels.
For the rare panels that
DesignGridLayout
cannot fully handle, I use a mix of Borderlayout andDesignGridLayout
.With DesigngridLayout you can manually code your layouts with a minimum number of lines of code, that are easy to type and read:
Each row of the panel grid is defined by one line of code. As you can see, "drawing" your panel is quite straightforward.
In addition, I find
DesignGridLayout
has some unique features (such as its "smart vertical resize").