Need one MultiColumnList component

Hi,

I need one component similar to JList but with multicolumn.

JList is list with only one column.

Any body has any idea.

pavan.
pavan_k_goyalAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
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
 
objectsCommented:
how about a JTable
0
 
pavan_k_goyalAuthor Commented:
No I don't want JTable....


Any thing else ?

Pavan

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
objectsCommented:
use multiple JList's.
0
 
OviCommented:
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
 
zzynxSoftware engineerCommented:
>> No I don't want JTable....
Any particular reason?
0
 
pavan_k_goyalAuthor Commented:
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
 
objectsCommented:
maker your table model uneditable by having isCellEditable() return false.
0
 
pavan_k_goyalAuthor Commented:
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
 
objectsCommented:
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
 
pavan_k_goyalAuthor Commented:
I have to use this Table in many screens... and I can not hardcode blank numbers of rows.

Any other solution ?

Pavan.
0
All Courses

From novice to tech pro — start learning today.