Results 1 to 4 of 4
Thread: JTable
- 10-23-2009, 01:20 PM #1
Member
- Join Date
- Jun 2009
- Posts
- 35
- Rep Power
- 0
JTable
Hi,
I have a JTable called 'table'. The table has four columns and some rows.
The columns are "firstName", "lastName","address"," married". firstName, lastName and address are textFields, married is a checkBox.
I have inserted some data into the table. Now, when i click into a particular row of the table, i want the firstName, lastName, address and married to show their information in the respective textField and checkBox.
I have added a mouseEvent to the table and tried to use table.getSelectedRow() and table.getSelectedColumn(), but it doesn't work. They give a single cell position at a time and i cannot manipulate them.
I will highly appreciate any help
thank you.
- 10-23-2009, 01:59 PM #2
Could u paste ur code using code tag?
Ramya:cool:
- 10-25-2009, 03:24 PM #3
Member
- Join Date
- Oct 2009
- Posts
- 88
- Rep Power
- 0
uset the logique as follow
Event is mouse clicked
Example:
private void mousedClicked(evt)
{
int rowselected=tablename.getSelectedRow();
Object textfield1=tablename.getValueAt(rowselected,0);
Object textfield2=tablename.getValueAt(rowselected,1);
Object textfield3=tablename.getValueAt(rowselected,2);
}
then typecast for String objectname.toString() for string and set value in textfiled
this can be done by texfieldname.setText(value); in the function of mouseclicked method i hope it will solve problem
- 10-27-2009, 11:30 PM #4
Member
- Join Date
- Jun 2009
- Posts
- 35
- Rep Power
- 0
Similar Threads
-
From txt to JTable.
By ocean in forum New To JavaReplies: 3Last Post: 10-17-2009, 09:30 PM -
Regarding JTable
By adeeb in forum AWT / SwingReplies: 12Last Post: 06-19-2008, 07:39 AM -
Regarding JTable
By adeeb in forum SWT / JFaceReplies: 0Last Post: 06-18-2008, 06:13 PM -
Jtable duplicates through Hashtable (JTable condition problem) my assignment plz help
By salmanpirzada1 in forum Advanced JavaReplies: 2Last Post: 05-15-2008, 10:15 AM -
How to add in a new row in Jtable?
By Ry4n in forum AWT / SwingReplies: 0Last Post: 01-18-2008, 12:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks