Results 1 to 4 of 4

Thread: GUI layout help

  1. #1
    mbschultz97 is offline Super OP Noob
    Join Date
    May 2014
    Location
    Virginia
    Posts
    65
    Rep Power
    0

    Default GUI layout help

    Right now I'm using a boxlayout but my textfield is huge and takes up most of the page and also my labels keep changing size and position depending on what value they have.

    Java Code:
    panelOne.setLayout(new BoxLayout(panelOne, BoxLayout.Y_AXIS));
    How can I have more control over the layout and keep the labels and textfield from moving around? thanks :)

  2. #2
    mbschultz97 is offline Super OP Noob
    Join Date
    May 2014
    Location
    Virginia
    Posts
    65
    Rep Power
    0

    Default Re: GUI layout help

    It's okay now I found how to make the GUI look how I wanted... I just set the layout of the panel for null ad set the size and position for everything on the GUI.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,616
    Rep Power
    5

    Default Re: GUI layout help

    I recommend you refrain from using absolute positioning of your components. It is best to read and understand how to the layout mangers work and let them do the positioning for you.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: GUI layout help

    That's exactly the opposite of alright: in stead of fixing the issue, you worked around it. I would advise you to stop what you're doing right now and dig deeper into layout managers - learn to use (and combine!) them properly.

    Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    Layout managers are your friend, don't treat them like your enemy only because you don't understand them yet. Live in their village, learn their ways.

    Edit: Ninja'd! This time you win Jim. I'll get you next time Gadget... NEXT TIME!
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Grid Layout change layout alignment of control s
    By rellicott in forum SWT / JFace
    Replies: 1
    Last Post: 02-13-2012, 05:11 PM
  2. Which Layout should I use?
    By Josep_16 in forum Java Applets
    Replies: 2
    Last Post: 08-17-2011, 03:42 PM
  3. Please Help me to do a layout
    By neway003 in forum AWT / Swing
    Replies: 3
    Last Post: 11-03-2010, 06:28 PM
  4. looking for a layout
    By imorio in forum AWT / Swing
    Replies: 3
    Last Post: 08-13-2010, 05:02 PM
  5. Edit layout Layout please help me
    By manhtungtnk28@gmail.com in forum New To Java
    Replies: 4
    Last Post: 11-23-2009, 08:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •