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 big fan of using TableLayout instead of GridBagLayout. Everything just makes sense, whereas every time I try to use GridBagLayout it crushes my soul.
I've found that for any non-trivial GUI I use multiple layouts with nested sub-panels where the main panel may have a
GridBagLayout
and each sub-panel (typically without a border or indication that it is a panel) uses a simpler layout where possible. Typically I'll useBorderLayout
,FlowLayout
, andBoxLayout
for smaller, simpler sub-panels. By dividing small sections of the GUI into sub-panels and using the simplest layout possible to control that section of the GUI you can create complex, well arranged displays without too much headache fromGridBagLayout
's many options. Also, by grouping like display functionality into a panel, it creates more readable code.I use the GridBagLayout. It seems to take alot of code, but it makes very good looking layouts.
I also like to combine BorderLayout with GridBagLayout panels for great customizability.
I've used GroupLayout as well. Again, its a standard JDK layout manager as of Java6, but you can find the library separate as well.
I have started using Swing recently and I am using GridBagLayout.
I prefer to minimize dependencies on 3rd party libs, so it's usually BoxLayout for dialogs and GridBagLayout for "complicated" layouts. GridBagLayout is easy enough to understand, but a bit hard to configure. I wrote myself a tool for creating the code from HTML layouts (hope that helps others too): http://www.onyxbits.de/content/blog/patrick/java-gui-building-gridbaglayout-manager-made-easy