JTable data display [message #1013041] |
Fri, 22 February 2013 16:50  |
Eclipse User |
|
|
|
I created a JTable named "table" on a JScrollPane using WindowBuilder. To understand how it works, I populated it within a button thusly:
String[] columnNames = {"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
Object[][] data = {
{"Kathy", "Smith","Snowboarding", new Integer(5), new Boolean(false)},
{"John", "Doe", "Rowing", new Integer(3), new Boolean(true)},
{"Sue", "Black", "Knitting", new Integer(2), new Boolean(false)},
{"Jane", "White", "Speed reading", new Integer(20), new Boolean(true)},
{"Joe", "Brown", "Pool", new Integer(10), new Boolean(false)}
}
table = new JTable(data, columnNames);
I have no errors, but when I click the button, I get no data appearing in the JTable.
Can anyone tell me what I am missing?
Thanks,
Bill
|
|
|
|
Re: JTable data display [message #1013064 is a reply to message #1013060] |
Fri, 22 February 2013 17:43   |
Eclipse User |
|
|
|
I have a button that executes the code I provided. I am trying to learn how to use a JTable. I created a form with a button and a JTable that attempts to populate the JTable when the button is clicked.
|
|
|
Re: JTable data display [message #1013143 is a reply to message #1013064] |
Fri, 22 February 2013 22:02  |
Eclipse User |
|
|
|
Ah. I would recommend posting your question to a Java/Swing forum as it is off-topic for this forum. This forum is specifically for questions about how to use WindowBuilder itself and not for questions about how to use Swing (or SWT or any other UI toolkit).
|
|
|
Powered by
FUDForum. Page generated in 0.03451 seconds