We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello guys,
I'm trying to show the visualization of data in "grid", the data of a database, I'm using the model as suggested in the previous post:
https://forum.processing.org/two/discussion/7325/create-a-table-in-which-the-user-can-input-values
Code Sample:
import javax.swing.JTable;
import javax.swing.JScrollPane;
size(600, 500, JAVA2D);
noLoop();
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)}
};
JTable table = new JTable(data, columnNames);
//JTable table = new JTable(100, 2);
JScrollPane scroll = new JScrollPane(table);
table.setFillsViewportHeight(true);
add(scroll);
It has a small problem, the table (grid) only appears when you click on the screen, ie, the screen appears to have nothing when you open, but when the mouse Click occurs, the normal show.
Note: I'm using 2.2.1 Processing
Any idea what might be missing?
Thank you,