Java - Swing - Layout Managers - Which one do you like?

Discussion in 'Mac Programming' started by toddburch, Mar 23, 2007.

  1. macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #1
    I'm getting into the "swing" of user interfaces (sorry...;)) and I'm wondering what Layout manager(s) you prefer to use? I've used the FlowLayout the most, but I don't like it so much, as controls will jump around when resizing the dialog boxes.

    Thanks, Todd
     
  2. macrumors 6502

    Joined:
    May 12, 2003
    #2
    For anything other than a really trivial layout, I often use TableLayout. It has a little bit of a learning curve, but it's very flexible.
     
  3. thread starter macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #3
    After seeing that your preferred layout is a Java add-on, (which I didn't realize might exist), I got to thinking about this concept some more, and started wondering about the existence of a WYSIWYG editor for Java GUIs.

    A quick search found SpringLayout (part of Java itself). I think I'll give it a go. :)

    (EDIT - it looks like this will solve one of my bigger pet peeves, in that TextAreas don't usually grow when the window is made larger. Using this layout manager, they will. WOO-HOO!)
     
  4. macrumors 6502

    Joined:
    May 12, 2003
    #4
    Yes, SpringLayout was designed for WYSIWYG editors. I've tried messing around with it and it seems pretty good. I like that it's human-readable/writable as well. Whichever layout fits your needs is the layout you should use.

    FWIW, last I heard, TableLayout was moving towards being included as a standard Java library. But don't let its current non-inclusion stop you from checking it out if you're interested. It's completely free (as in speech as well as in beer) to use however you want.

    Most layout managers will do this if you use them correctly. ;)
     

Share This Page