Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: misalignment of list items

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default misalignment of list items

    Hello All,

    My code reads like this. I have used the AWT
    list l = new List(50, true);
    add(list);
    --
    ---
     
    --
    for (int i =0; int i < cnt; i++)
    l.add( name[i] + "    " + initial[i] + "   " + address[i] +"    "+ .............);
    }
    My problem is when it displays the list, the items alignment is lost. Each field displays at different location in due to the different sizes of the previous field. like below

    johnmichael tester street10
    George verky Ganeshmandhir
    Ram Goenka location1

    Can anyone suggest how to fix the problem.

    thanks
    Last edited by helloworld922; March 16th, 2010 at 01:40 AM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,307
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: misalignment of list items

    If I understand the problem correctly you can display the data in a JTable and the alignment will be specified by the table itself

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: misalignment of list items

    Thanks. will give a try.

Similar Threads

  1. list in JSP
    By smackdown90 in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: November 13th, 2011, 12:08 PM
  2. [SOLVED] adding items to a binary tree
    By vendetta in forum Algorithms & Recursion
    Replies: 4
    Last Post: February 26th, 2010, 08:32 PM
  3. How to get a sum value from items listed in array ?
    By makarov in forum Loops & Control Statements
    Replies: 0
    Last Post: January 6th, 2010, 05:11 PM
  4. Arrays: question about "removing" items.
    By sanfor in forum Collections and Generics
    Replies: 2
    Last Post: November 30th, 2009, 03:09 AM
  5. Different operation on Array
    By jempot in forum Collections and Generics
    Replies: 4
    Last Post: January 27th, 2009, 05:07 AM