Results 1 to 6 of 6

Thread: java layouts

  1. #1
    Diriglontz is offline Member
    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    Default java layouts

    Hey! I need to make a project for school and I want to make a design like in the photo I attached.
    I can use just layouts like: BorderLayout, BoxLayout, CardLayout, FlowLayout, GridBagLayout, GridLayout, GroupLayout, SpringLayout.
    I've tryed lots of layouts, but i couldn't make it look like that.

    ps. the design from the picture is made in NetBeans using a JFrame designer
    Attached Thumbnails Attached Thumbnails java layouts-java.jpg  

  2. #2
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: java layouts

    Don't try to make everything with one layout. Some layouts are better for a specific look than others. Draw it out on paper use colored markers to indicate each layout. Learn specifics of each layout and then try to combine them into what you want.

    At first, it's hard to code this by hand, but as you get to know the different layouts, you'll never want to use a GUI designer again...
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    pj6444 is offline Senior Member
    Join Date
    Jan 2013
    Posts
    165
    Rep Power
    2

    Default Re: java layouts

    If you can use the NetBeans editor, I would suggest using the AbsoluteLayout(aka null layout) and set them using the NetBeans editor.

  4. #4
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: java layouts

    Quote Originally Posted by pj6444 View Post
    If you can use the NetBeans editor, I would suggest using the AbsoluteLayout(aka null layout) and set them using the NetBeans editor.
    Seriously? Of all the layout choices you can make, this is *not* the one you want. Two errors here: NetBeans editor and Absolute layout. Like I said, experiment with a few layouts, and combine them as you see fit. Of the layoutmanagers you mentioned, study GroupLayout and SpringLayout last, since they are very complex and usually only used by GUI builders like the NetBeans one.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  5. #5
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: java layouts

    You DEFINITLY could make it look like that with GridBagLayout. I know you said you "tried" it, but GBL can't just simply be "tried". You can do absolutely ANYTHING with it (as far as layouts go), but it is VERY complicated, and takes a while to "learn the ropes" and "get the hang of it". All that said, I love it, it is the only one I use if I am placing more than, say, 5 elements.

    But then, I am a bit of a masochist in that regard. ;-)

    P.S. In regards to the "null" layout: NOOOOOOOOOOOOOOOO! If your gui will only EVER run on ONE screen resoultion with ONE font size "resolution", okay, OTHERWISE, be prepared for compatability HELL.

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

    Default Re: java layouts

    People who use, like and recommend a null-layout simply haven't been exposed to the 'real world' yet and thus don't really have the experience yet to be passing out advice (but that's a rant beside the point - one I'm still going to continue in a second because nobody can stop me). Its so easy to say that it is a good solution when you only work on your own computer - then you can tailor everything to your computer's specifications alone and things just work splendidly. And then you give your stuff to someone else who has slightly different specifications than your machine and BAM - things don't work so well anymore. "Uh did you install the latest drivers? "because it of course cannot be a fault of yours, you were a genius for using a null-layout where everyone else keeps on being dumb trying to use hard to master layout managers.

    Its not something really to feel ashamed for too, it's just a sign of a novice. I did exactly the same in the first five years of my development career; I created simple games which worked just fine on my own machine but then when run on another the game ran either too fast or too slow because the CPU was faster or slower; I hadn't grasped the concepts yet, I had only found ONE WAY that made it possible for me to get a game running; the most poor way possible as it turns out. But I did write a dozen tutorials in that novice state spreading the use of that poor way of programming because I just HAD to share my epic knowledge that I had just learned the week before but did not understand yet.

    When I look in the forums today now some 15 years later, I still see the exact same thing happening, but worsened because now its far easier for novices to spread their epic knowledge through so many different channels.

    Sorry if that offended someone, its just the way it was and the way it is and I don't let people being offended shy me away from trying to get people to not make the same mistakes I did and ultimately paid a price for.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Layouts
    By tnrh1 in forum AWT / Swing
    Replies: 3
    Last Post: 12-06-2011, 08:00 PM
  2. Swing layouts
    By jayragz in forum AWT / Swing
    Replies: 2
    Last Post: 07-08-2011, 11:10 AM
  3. Java Panels and Layouts help
    By Zookey in forum New To Java
    Replies: 2
    Last Post: 01-30-2011, 12:06 PM
  4. problems with layouts !
    By ron2794 in forum NetBeans
    Replies: 1
    Last Post: 12-15-2010, 01:23 AM
  5. Layouts ?
    By plodos in forum Eclipse
    Replies: 3
    Last Post: 07-30-2007, 03:03 PM

Posting Permissions

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