Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need one MultiColumnList component

Posted on 2004-10-21
13
Medium Priority
?
297 Views
Last Modified: 2008-02-01
Hi,

I need one component similar to JList but with multicolumn.

JList is list with only one column.

Any body has any idea.

pavan.
0
Comment
Question by:pavan_k_goyal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
13 Comments
 
LVL 92

Expert Comment

by:objects
ID: 12376290
how about a JTable
0
 

Author Comment

by:pavan_k_goyal
ID: 12377870
No I don't want JTable....


Any thing else ?

Pavan

0
 
LVL 92

Expert Comment

by:objects
ID: 12377895
use multiple JList's.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 9

Expert Comment

by:Ovi
ID: 12378202
If you are using JDK 1.4 and above, this feature is allready implemented. You can use'it like this:

JList list = new JList();
list.setLayoutOrientation(JList.VERTICAL_WRAP);
list.setFixedCellWidth(300);

This piece of code will create a list and wrap the data inside in multiple columns.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12378284
>> No I don't want JTable....
Any particular reason?
0
 

Author Comment

by:pavan_k_goyal
ID: 12453445
Ok. If I use JTable and set following selection mode

table.setRowSelectionAllowed(true);
and I click on one row in table, it select entire row but it keeps unselected the cell column under
the mouse pointer. and If I double click the mouse, Ican  change the content of cell , that I don't want.

How to prevent this ???


Pavan
0
 
LVL 92

Expert Comment

by:objects
ID: 12454162
maker your table model uneditable by having isCellEditable() return false.
0
 

Author Comment

by:pavan_k_goyal
ID: 12477152
Thanks, that worked fine.
Here I've some more problems.

JTable is drawing only as many lines as no of records(I'm passing at then time of table creation).
I have screen that has got one button and one text box and one Table.
Initially when I open that screen, I don't have any data to add to table.
User is supposed to enter some text in text box and click button... java program will fetch the data from database and retried data needs to be populated in Table.

I  want following things.

1. When I open the screen, (since I don't have any data) JTable should display blank lines.
2. I should be able to populate data n JTable Dyanamically based on the query results.
3. Currently Foreground colour for text in JTable is black. When I select a record, it's color should change to white(beacuse I need selec tion color to be black).


Pavan
0
 
LVL 92

Expert Comment

by:objects
ID: 12478520
Fill your table with empty rows, and when populating instead of adding new rows fill in the empty ones.
Use table.setSelectionForeground(Color.white) to change the selected foreground colour.
0
 

Author Comment

by:pavan_k_goyal
ID: 12479390
I have to use this Table in many screens... and I can not hardcode blank numbers of rows.

Any other solution ?

Pavan.
0
 
LVL 92

Accepted Solution

by:
objects earned 800 total points
ID: 12479430
No alternative that I can think of. The table only renders rows that exist in the model, if there are no rows then its not going to paint any.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question