Search:

Type: Posts; User: copeg

Search: Search took 0.09 seconds.

  1. Thread: Aligning labels

    by copeg
    Replies
    11
    Views
    1,583

    Re: Aligning labels

    My comment was independent of layouts - mixing the Components should be avoided for reasons you can find by googling. Suffice it to say, Layouts in the links I provided above are find for both AWT...
  2. Thread: Aligning labels

    by copeg
    Replies
    11
    Views
    1,583

    Re: Aligning labels

    The method setLayout is defined by the class Container...it must be called on an object that is or extends the class Container. For example, the JPanel you defined:


    myPanel.setLayout(myLayout);...
  3. Thread: Aligning labels

    by copeg
    Replies
    11
    Views
    1,583

    Re: Aligning labels

    Define 'it didn't work'....and yes you need a JFrame - that code snippet was just a demonstration for the Layout to incorporate into your code.
  4. Thread: Aligning labels

    by copeg
    Replies
    11
    Views
    1,583

    Re: Aligning labels

    See the following link for details:
    How to Use BoxLayout (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)

    The main concept is to create a JPanel,...
  5. Thread: Aligning labels

    by copeg
    Replies
    11
    Views
    1,583

    Re: Aligning labels

    Sorry it wasn't that helpful, but that link was for novices, and its one of the best resources for newcomers to the language to dive into. Amongst the list of layouts in that page, which looks...
  6. Thread: Aligning labels

    by copeg
    Replies
    11
    Views
    1,583

    Re: Aligning labels

    Use a LayoutManager. See the following link for the most appropriate Layouts. Also note that layouts can be nested - JPanel within JPanel with different layouts as needed.
    A Visual Guide to Layout...
Results 1 to 6 of 6