Results 1 to 2 of 2
Thread: get the select row from a jtable
- 05-21-2011, 05:27 PM #1
Member
- Join Date
- May 2011
- Posts
- 7
- Rep Power
- 0
get the select row from a jtable
Hello i have done a jtable with a button and i want to get the selected row after i click my button! here is the button code..
Java Code:button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (table.getColumnSelectionAllowed() && !table.getRowSelectionAllowed()) { // Column selection is enabled // Get the indices of the selected columns int[] vColIndices = table.getSelectedColumns(); } else if (!table.getColumnSelectionAllowed() && table.getRowSelectionAllowed()) { // Row selection is enabled // Get the indices of the selected rows rowIndices = table.getSelectedRows(); } if (rowIndices.length > 0) { for (int i = 0; i <= rowIndices.length; i++) { System.out.println(rowIndices[i]); } } } });
-
Crosspost: get-the-selected-row
It is considered inconsiderate to cross-post the same question in multiple forum without notifying all forums involved. No, we're not related to stackoverflow, and to understand why this is an issue, I ask that you read this link: BeForthrightWhenCrossPostingToOtherSites
Thanks in advance for reading the link and for responding in an understanding and mature way.
edit: and posters here would see that the question has already been answered!Last edited by Fubarable; 05-21-2011 at 05:44 PM.
Similar Threads
-
Select a row in Jtable
By pink123 in forum AWT / SwingReplies: 5Last Post: 03-21-2011, 03:04 PM -
Auto select JCombo box Adding to JTable
By kasiram.p@gmail.com in forum AWT / SwingReplies: 0Last Post: 01-03-2011, 06:08 AM -
Problems with Shift select in Jtable
By kovski88 in forum Advanced JavaReplies: 0Last Post: 01-28-2010, 04:04 PM -
result select sql in jtable
By herfnai in forum JDBCReplies: 0Last Post: 08-17-2008, 12:20 PM -
result select sql in jtable
By herfnai in forum JDBCReplies: 0Last Post: 08-17-2008, 12:20 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks