Results 1 to 12 of 12
  1. #1
    carderne is offline Senior Member
    Join Date
    Nov 2007
    Posts
    160
    Rep Power
    7

    Default Irritating Netbeans GUI layout

    I have two JLists and I'm trying to put them right next to each other (touching). Netbeans won't let me do it. As soon as i drag the JLists closer than a mm or two in auto positions them away...

    I'm sure there's a simple way around this, but I've tried setting preferred size in Properties etc...

  2. #2
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    6

    Default

    Try setting the layout manager to null then manually configure their location.
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  3. #3
    carderne is offline Senior Member
    Join Date
    Nov 2007
    Posts
    160
    Rep Power
    7

    Default

    Layout manager to null? Where is that option? Will have a look but not at my PC just yet...

  4. #4
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    That means, you should do it manually....
    Sun's Java tutorial may lead you in the right way if you gonna try it.

    but, maybe you forgot this

    rightclick on that component which you want to change the position slightly,

    and find "Space Around Component", or near to that group of words.
    freedom exists in the world of ideas

  5. #5
    carderne is offline Senior Member
    Join Date
    Nov 2007
    Posts
    160
    Rep Power
    7

    Default

    Ya, I gathered he said I should do it manually, but do I first need to disable the auto-positioning or whatever it's called. I've seen vibe space around component ortho before, but iirc you can't set it to 0, only to 'very small' or something... Will have a look in the morning when back at PC.

  6. #6
    carderne is offline Senior Member
    Join Date
    Nov 2007
    Posts
    160
    Rep Power
    7

    Default

    My bad. Didn't realize you can set manual values for the space around component thing. Thanks and SOLVED.

  7. #7
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    You may now mark this thread as SOLVED....
    freedom exists in the world of ideas

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    I always use absolute layout to GUI managing in NetBeans. It's much easier than all other layouts.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    The other option is to put both lists into a JPanel and set the JPanel's layout to GridLayout, and then set this holding JPanel wherever you want to in your main application. Be sure to set the GridLayout's properties to columns = 2, rows = 1, with 0 for both Vertical and Horizontal Gaps.

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Yep. Working on GridLayout is fine too. But it make real mess for lots of users that without working on an IDE. :)

  11. #11
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by Eranga View Post
    Yep. Working on GridLayout is fine too. But it make real mess for lots of users that without working on an IDE. :)
    I'm sorry, please clarify?

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Ah, just remember the past time in Java. IDEs are not heavily used. All are working on Notepad and command prompt. So we have to do lots of things there.

    Add grids, set gaps and all have to code. At the same time if we want to deal with GroupLayout situation is more worst.

    At that time everything is need to code, but what I try to say is, GUI component like those grids take a long way to implement. Say a button, we can implement it within a line actually. So how much IDEs help to make easy such things.

Similar Threads

  1. Border Layout
    By mark-mlt in forum Java Applets
    Replies: 5
    Last Post: 05-12-2008, 09:48 AM
  2. Help with JButton and layout
    By adlb1300 in forum AWT / Swing
    Replies: 1
    Last Post: 12-25-2007, 08:33 AM
  3. Layout Managers
    By gmioannou in forum AWT / Swing
    Replies: 1
    Last Post: 12-24-2007, 04:12 AM
  4. Help with Grid Layout
    By coco in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 08: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
  •