pavan_k_goyal
asked on
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.
I need one component similar to JList but with multicolumn.
JList is list with only one column.
Any body has any idea.
pavan.
how about a JTable
ASKER
No I don't want JTable....
Any thing else ?
Pavan
Any thing else ?
Pavan
use multiple JList's.
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.VERT ICAL_WRAP) ;
list.setFixedCellWidth(300 );
This piece of code will create a list and wrap the data inside in multiple columns.
JList list = new JList();
list.setLayoutOrientation(
list.setFixedCellWidth(300
This piece of code will create a list and wrap the data inside in multiple columns.
>> No I don't want JTable....
Any particular reason?
Any particular reason?
ASKER
Ok. If I use JTable and set following selection mode
table.setRowSelectionAllow ed(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
table.setRowSelectionAllow
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
maker your table model uneditable by having isCellEditable() return false.
ASKER
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
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
Fill your table with empty rows, and when populating instead of adding new rows fill in the empty ones.
Use table.setSelectionForegrou nd(Color.w hite) to change the selected foreground colour.
Use table.setSelectionForegrou
ASKER
I have to use this Table in many screens... and I can not hardcode blank numbers of rows.
Any other solution ?
Pavan.
Any other solution ?
Pavan.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.