New to swing, need gui layout help - Java

This is a discussion on New to swing, need gui layout help - Java ; I have been using java for years, now I need to go gui work. I am having a Dickens of a time trying to grasp the swing layout managers, specifically how to control placement on screen. I am not looking ...

+ Reply to Thread
Results 1 to 8 of 8

New to swing, need gui layout help

  1. Default New to swing, need gui layout help

    I have been using java for years, now I need to go gui work. I am
    having a Dickens of a time trying to grasp the swing layout managers,
    specifically how to control placement on screen.

    I am not looking for an IDE, but want to gain a better understanding
    of the mechanics of how the layout managers "decide" to layout
    components. Most references I have found only parrot what the API
    javadocs , which are terse as best.

    Does anyone have real world examples of laying out java swing UIs?

    I am sure I will be flamed for this general, newbie question, assuming
    somewhere on this group this question has been asked and answered.
    Sorry in advance.

    cj


  2. Default Re: New to swing, need gui layout help

    CJ wrote:
    > I have been using java for years, now I need to go gui work. I am
    > having a Dickens of a time trying to grasp the swing layout managers,
    > specifically how to control placement on screen.
    >
    > I am not looking for an IDE, but want to gain a better understanding
    > of the mechanics of how the layout managers "decide" to layout
    > components. Most references I have found only parrot what the API
    > javadocs , which are terse as best.
    >
    > Does anyone have real world examples of laying out java swing UIs?
    >
    > I am sure I will be flamed for this general, newbie question, assuming
    > somewhere on this group this question has been asked and answered.
    > Sorry in advance.


    The Java Tutorial at http://java.sun.com/docs/books/tutorial/
    is as good a place as any to start learning.

    I also found the http://java.sun.com/developer/ article
    "Effective Layout Management: Short Course" to be helpful.

    If all else fails, Google Java layout manager and browse
    the two and a half million hits it turns up. Even if Sturgeon's
    Law holds, there's a quarter-million useful links among them.

    --
    Eric Sosman
    esosman@ieee-dot-org.invalid

  3. Default Re: New to swing, need gui layout help

    CJ wrote:
    > I am sure I will be flamed for this general, newbie question,


    You deserve flaming for multiposting instead of crossposting!
    http://www.cs.tut.fi/~jkorpela/usenet/xpost.html

    > assuming
    > somewhere on this group this question has been asked and answered.


    I just answered it in one of the other newsgroups you posted it to.

    > Sorry in advance.


    That doesn't make me feel any better about having wasted my time
    unknowingly duplicating what Eric wrote here. This would not have
    happened if you'd crossposted instead of multiposted.

  4. Default Re: New to swing, need gui layout help

    On Sep 1, 1:53 pm, Eric Sosman <esos...@ieee-dot-org.invalid> wrote:
    > CJ wrote:
    > > I have been using java for years, now I need to go gui work. I am
    > > having a Dickens of a time trying to grasp the swing layout managers,
    > > specifically how to control placement on screen.

    >
    > > I am not looking for an IDE, but want to gain a better understanding
    > > of the mechanics of how the layout managers "decide" to layout
    > > components. Most references I have found only parrot what the API
    > > javadocs , which are terse as best.

    >
    > > Does anyone have real world examples of laying out java swing UIs?

    >
    > > I am sure I will be flamed for this general, newbie question, assuming
    > > somewhere on this group this question has been asked and answered.
    > > Sorry in advance.

    >
    > The Java Tutorial athttp://java.sun.com/docs/books/tutorial/
    > is as good a place as any to start learning.
    >
    > I also found thehttp://java.sun.com/developer/article
    > "Effective Layout Management: Short Course" to be helpful.
    >
    > If all else fails, Google Java layout manager and browse
    > the two and a half million hits it turns up. Even if Sturgeon's
    > Law holds, there's a quarter-million useful links among them.
    >
    > --
    > Eric Sosman
    > esos...@ieee-dot-org.invalid


    Thanks Eric. I have been through the sun tutorials. I have also read
    many of the "two and a half million hits" google turns up. Most are
    just a parrot of the tutorials and none describe the mechanics of
    layout managers. Sure if one only needs to write calculators, the
    tutorials are extremely useful. But I notice that all IDEs I have
    looked into use hand rolled layout managers, indicating the JDK layout
    managers are not as useful for more real world apps.

    However, the link you provide does move me forward a bit.

    cj


  5. Default Re: New to swing, need gui layout help

    On Sep 1, 4:13 pm, RedGrittyBrick <RedGrittyBr...@SpamWeary.foo>
    wrote:
    > CJ wrote:
    > > I am sure I will be flamed for this general, newbie question,

    >
    > You deserve flaming for multiposting instead of crossposting!http://www.cs.tut.fi/~jkorpela/usenet/xpost.html
    >
    > > assuming
    > > somewhere on this group this question has been asked and answered.

    >
    > I just answered it in one of the other newsgroups you posted it to.
    >
    > > Sorry in advance.

    >
    > That doesn't make me feel any better about having wasted my time
    > unknowingly duplicating what Eric wrote here. This would not have
    > happened if you'd crossposted instead of multiposted.


    All I can say is sorry for the multi post. Accept the apology or not,
    no skin off my nose. I am looking for information in a timely fashion
    and will proceed with that as my sole goal.

    Thanks for the education on posting. And thanks for you suggestion,
    but it too does little to enlighten me on the mechanics of layout
    managers in java swing.

    cj


  6. Default Re: New to swing, need gui layout help

    CJ wrote:

    > Thanks Eric. I have been through the sun tutorials. I have also read
    > many of the "two and a half million hits" google turns up. Most are
    > just a parrot of the tutorials and none describe the mechanics of
    > layout managers. Sure if one only needs to write calculators, the
    > tutorials are extremely useful. But I notice that all IDEs I have
    > looked into use hand rolled layout managers, indicating the JDK layout
    > managers are not as useful for more real world apps.


    Actually, the IDE use layout managers that are easy for a programmatic
    system to generate code for.

    Have you looked into NetBeans? It's layout manager (Spring, I think) is
    now standard in Java 1.5 or 1.6 or so. So you don't have to try to add
    it to your jars. Just require the latest Java and you're good.

    O'Reilly's _Learning Java_ goes into layout managers quite a bit. I
    don't know if it has more detail than the tutorials you've looked at,
    but if you don't mind one more dead tree on your bookshelf you might
    check into it. The explanations are brief but also informative, and
    cover most common functionality of the pre-1.4 layout managers. It is
    better than the dead simple make-a-calculator examples I've seen.

    I can't really talk about any other Swing GUI books. LJ is all I own...

    Good luck.


  7. Default Re: New to swing, need gui layout help

    CJ wrote:
    > I have been using java for years, now I need to go gui work. I am
    > having a Dickens of a time trying to grasp the swing layout managers,
    > specifically how to control placement on screen.
    >
    > I am not looking for an IDE, but want to gain a better understanding
    > of the mechanics of how the layout managers "decide" to layout
    > components. Most references I have found only parrot what the API
    > javadocs , which are terse as best.
    >
    > Does anyone have real world examples of laying out java swing UIs?
    >

    I've seen a lot of examples using nested Box layouts, which seems to
    work tolerably well, e.g. making rows with horizontal Box layouts and
    then stacking those in a vertical Box layout.

    For dialogue windows, e.g. where each line is a JLabel and a JTextField
    or JTextArea, I've had good results with the 3rd party RiverLayout
    layout manager:

    http://www.datadosen.se/riverlayout/

    > I am sure I will be flamed for this general, newbie question, assuming
    > somewhere on this group this question has been asked and answered.
    > Sorry in advance.
    >

    I think layout managers is a difficult area to get a handle on when
    you're starting to use a GUI interface.


    --
    martin@ | Martin Gregorie
    gregorie. | Es**** UK
    org |

  8. Default Re: New to swing, need gui layout help

    CJ <spambox1@mindspring.com> wrote:

    >I have been using java for years, now I need to go gui work. I am
    >having a Dickens of a time trying to grasp the swing layout managers,
    >specifically how to control placement on screen.
    >
    >I am not looking for an IDE, but want to gain a better understanding
    >of the mechanics of how the layout managers "decide" to layout
    >components.

    The authors of the NetBeand IDE undertook a similar task when they
    tried to "explain" a complex GUI layout to a computer. They decided
    that none of the existing layout managers was up to the task and
    devised a new one. I have not tried to use it directly but from other
    posts it seems that the resulting Group Layout is not suitable for
    human coders.

    Consider the possibility that a modern GUI is sufficiently complex to
    require a graphical design tool rather than a traditional, text based,
    specification. Even if you ultimately reject an IDE you may find it
    useful in gaining a better understanding of layout managers because it
    will instantly show you the result of changing from one layout manager
    to another.

+ Reply to Thread

Similar Threads

  1. Newbi to swing, need layout knowledge
    By Application Development in forum Java
    Replies: 2
    Last Post: 09-02-2007, 05:51 AM
  2. javax.swing.JPopupMenu cannot be cast to javax.swing.JMenuItem
    By Application Development in forum Java
    Replies: 3
    Last Post: 04-18-2007, 11:04 AM
  3. Swing Spring Layout
    By Application Development in forum Java
    Replies: 0
    Last Post: 02-11-2005, 10:27 AM
  4. Re: Does Swing have XYWH layout
    By Application Development in forum Java
    Replies: 0
    Last Post: 04-01-2004, 03:35 PM
  5. [swing] null Layout und positionierung
    By Application Development in forum Java-Games
    Replies: 0
    Last Post: 07-05-2003, 06:00 PM