Help
-
Search
-
Members
-
Calendar
Full Version:
Using JTable events?
MSFN Forums
>
Coding, Scripting and Servers
>
Web Development (HTML, Java, PHP, ASP, XML, etc.)
Internet
Forums
Unattended CD/DVD Guide
YoussefGamil
Aug 11 2005, 07:27 AM
Hi,
Iam really having a problem..
I want to make a Table which shows the value of the selected item and
it's index in the selected Column and Row..
So, could anyone help me by an examples,please?
Thanks for help.
Youssef Gamil
Stalkie
Aug 14 2005, 04:23 AM
Check this out
http://java.sun.com/docs/books/tutorial/ui....html#selection
YoussefGamil
Aug 14 2005, 04:50 PM
THANKS FOR YOUR HELP
but,I think I should search Google first to save your work
as I found this page before using google after asking that question..
THANKS AGAIN
THANKS 4 ALL
BUT,Can I ask one more question which I didn't found an answer for it?
Can I get JTable in form of 2D String Array?
THANKS AGAIN
THANKS 4 ALL
Stalkie
Aug 19 2005, 02:50 AM
You can try something like this (haven't tested it)
CODE
public String[][] getElements (JTable table)
{ String[][] values = new String[table.getRowCount()][table.getColumnCount()];
for (int i=0; i<table.getRowCount(); i++)
{ for (int j=0; j<table.getColumnCount(); j++)
{ values[i][j] = (String)table.getValueAt(i, j);
}
}
return values;
}
Internet
Forums
Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here
.