JTable help
From: Jacob Abraham (pmattackal_at_yahoo.com)
Date: 02/28/04
- Next message: Alvaro: "Re: I lose my HeaderRenderer when I install CellRenderer"
- Previous message: Lee Fesperman: "Re: Parse a SQL select statement"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Feb 2004 18:59:02 -0800
Hi guys
I am new to Java and was having some problems with JTables
Heres what I am trying to do.
I have a JTable with a list of entries, When I select an entry, I want
to see the fields in editing panel below the table populated with the
corresponding values. i.e. the sole purpose of the table is display
and selection only.
The table has three fields
-----Name----- ----Discription---- ---Age----
The editing panel has 2 JTextFields(Name, Age) and a
JTextArea(Discription).
Sample Table
-----Name----- ----Discription---- ---Age----
Tom This is a disc of Tom 39
Jerry This is a disc of Jerry 20
Mary This is a disc of Mary 33
So when I select Jerry for example, the editor panels should populate
with
Jerrys details. I can edit it and when I click on another entry or the
save button, the table entry for Jerry should be updated.
Thats the goal.
Heres my approach. I created a custom Cell editor/renderer that was
called anytime a field was clicked. This would populate the
appropriate fields in the editor panels.
The problem I was facing was that when I clicked on a row, the
TableCellRenderer class would not report the row as selected and this
throws of everything.
(isSelected param of getTableCellRendererComponent is always false).
CAn anybody give me pointers on what I might have missed or even an
easier approach
Thanks
JAcob
- Next message: Alvaro: "Re: I lose my HeaderRenderer when I install CellRenderer"
- Previous message: Lee Fesperman: "Re: Parse a SQL select statement"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]