I'm new to Java GUI and trying to work with jTable's in SWING. I currently have one which I made by following the Oracle tutorial and it gets the table data by using:
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)}
};
I have an object called Orders which has an ArrayList (productsInOrder) which contains an unlimited number of Project objects. I am trying to get the table to display each of the following for each object in the ArrayList. productsInOrder.getPrice() productsInOrder.getSKU() productsInOrder.getName()
Can anyone point me in the right direction? Or link me to a tutorial that can help as I've looked all over the internet and can not figure this out.
Finally, I have elsewhere I have an action listener which adds more Product objects to the ArrayList when the user performs certain actions. How would I update the jTable? Simply by reloading the whole jTable in the action listener or is there a way to simply add another row to the table?