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: JList with multiple columns

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default JList with multiple columns

    Quick question.

    Is it possible to create a JList where each entry of data is two column long? Specifically, I want a word and then a checkbox associated with that word in the next column.

    I was hoping to avoid JTable for this. If I have to use JTable, is there a way to hide the row and column lines? Those lines are very unappealing for what I am trying to accomplish.

    Information and links to tutorials or whatever would help me greatly.

    Thanks in advance.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: JList with multiple columns

    You could use a custom renderer with your JList: How to Use Lists (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

    That's the way I would probably go. It's actually pretty easy, and I think it's more specific to the functionality that you want.

    If you did go the JTable way, you can simply setShowHorizontalLines and setShowVerticalLines: JTable (Java Platform SE 6)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: JList with multiple columns

    Did that work for you?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. [SOLVED] JTables: How do I adjust row order as I drag columns?
    By assel in forum AWT / Java Swing
    Replies: 3
    Last Post: December 7th, 2010, 04:51 PM
  2. Building Table of Specified Rows and Columns
    By wale89 in forum Java Servlet
    Replies: 1
    Last Post: August 3rd, 2010, 08:57 AM
  3. Problem with jList
    By nextdigit in forum AWT / Java Swing
    Replies: 1
    Last Post: April 16th, 2010, 06:19 PM
  4. Need a loop for rows and columns
    By Ceasar in forum Loops & Control Statements
    Replies: 8
    Last Post: October 9th, 2009, 05:47 PM
  5. Dropping to graphic element dragged from JList
    By tua1 in forum AWT / Java Swing
    Replies: 1
    Last Post: November 29th, 2008, 08:22 AM