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 4 of 4

Thread: Custom JList

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Custom JList

    Hello,

    when we use default JList filled with some values we get something like this:



    Is it possible to make a custom JList, which I could fill with several values (as in the image below), where I could specify those values and their position in JList (for example as in the picture "Name" at the left side, "Birth" right side, "Address" at the bottom)?



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

    Default Re: Custom JList

    Write a Custom Cell Renderer, a class that implements ListCellRenderer and set the JList cell renderer passing this an instance of this class. See the following link: How to Use Lists (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

  3. The Following User Says Thank You to copeg For This Useful Post:

    daghost (November 17th, 2011)

  4. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Custom JList

    thank you very much, this is exactly what I needed :-)

  5. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Custom JList

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/51400-custom-jlist.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


Similar Threads

  1. Can't instantiate custom class
    By mwr76 in forum Object Oriented Programming
    Replies: 5
    Last Post: October 18th, 2011, 05:43 PM
  2. Custom Log level help
    By seanman in forum Java SE APIs
    Replies: 1
    Last Post: September 25th, 2011, 08:55 PM
  3. can i use custom buttons ?
    By Gaurav18 in forum Member Introductions
    Replies: 3
    Last Post: September 12th, 2011, 09:56 AM
  4. Custom Table using AbstractTableModel
    By dumb_terminal in forum AWT / Java Swing
    Replies: 11
    Last Post: November 16th, 2010, 10:02 AM
  5. Creating a custom panel:
    By xterradaniel in forum AWT / Java Swing
    Replies: 19
    Last Post: October 3rd, 2010, 07:15 PM