| Author |
jtable help
|
keiyia jackson
Ranch Hand
Joined: Jul 16, 2001
Posts: 49
|
|
|
Need help getting a row in the table to open another window.
|
 |
Javaoops
Ranch Hand
Joined: Jun 21, 2001
Posts: 57
|
|
in which way u want to be done, in selection of the row or through mouse right click popupmenu.
|
 |
keiyia jackson
Ranch Hand
Joined: Jul 16, 2001
Posts: 49
|
|
|
So far I have code that selects a row and code to right mouse click. I need both ways.
|
 |
Javaoops
Ranch Hand
Joined: Jun 21, 2001
Posts: 57
|
|
Delare these statement in init method of main frame detailFrame = new JFrame(); detailPanel = new detailContentPanel(); detailFrame.add("Center",detailPanel); declare the statement in ActionCommand of popmenu. int selectedRow = tableView.getSelectedRow(); int colCount = getColumnCount(); Vector data = new Vector(); For(int count =0;count<colCount;count++)> { data.add(table.getValueAt(selectedRow,count)); } detailPanel.initValues(data); detailFrame.pack(); detailFrame.setVisible(true); Declare a new panel class so that you can customize the values passed from the frame. public class detailContentPanel extends Panel { detailContentPanel() { } protected void initValues(Vector vec) { } } On selection of a row can also be done using the same as above. U have to add the same on mouse click to perform the same when the row is selected. 
|
 |
Javaoops
Ranch Hand
Joined: Jun 21, 2001
Posts: 57
|
|
For(int count=0;count is less than colCount;count++)
|
 |
Javaoops
Ranch Hand
Joined: Jun 21, 2001
Posts: 57
|
|
Change the for statement in ealier code which is incomplete. for(int count=0;count less than colCount;c++)
|
 |
 |
|
|
subject: jtable help
|
|
|