Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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: Tue Jul 22 18:45:45 EDT 2025

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

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

Back to the top