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 16:50 Go to next message
Bill Brandley is currently offline Bill BrandleyFriend
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 17:36 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 886
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 17:43 Go to previous messageGo to next message
Bill Brandley is currently offline Bill BrandleyFriend
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 22:02 Go to previous message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 886
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: Thu Dec 18 01:00:56 GMT 2014

Powered by FUDForum. Page generated in 0.01669 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software