Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » JTable data display(Displaying data within a JTable)
JTable data display [message #1013041] Fri, 22 February 2013 11:50 Go to next message
Bill Brandley is currently offline Bill Brandley
Messages: 12
Registered: October 2011
Junior Member
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 #1013060 is a reply to message #1013041] Fri, 22 February 2013 12:36 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric Clayberg
Messages: 832
Registered: July 2009
Location: Boston, MA
Senior Member
Um... what "button" are you clicking on?
Re: JTable data display [message #1013064 is a reply to message #1013060] Fri, 22 February 2013 12:43 Go to previous messageGo to next message
Bill Brandley is currently offline Bill Brandley
Messages: 12
Registered: October 2011
Junior Member
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 17:02 Go to previous message
Eric Clayberg is currently offline Eric Clayberg
Messages: 832
Registered: July 2009
Location: Boston, MA
Senior Member
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).
Previous Topic:WindowBuilder Can not render GUI
Next Topic:Game Project for University
Goto Forum:
  


Current Time: Fri Apr 18 21:53:17 EDT 2014

Powered by FUDForum. Page generated in 0.01510 seconds