我制作了JTable
预设值Miscitems
和Miscdata:
String [] Miscitems = {"Card Table", "Chair, Folding", "Fan", "Filing Cabinet, 2drs", "Filing Cabinet, 4drs", "Hamper",
"Heater", "Ironing Board", "Plant Pots", "Plant Stand/Pillars", "Statues", "Suitcase", "Trunk"};
Object [] Miscdata = {2, 1, 3, 10, 20, 5, 5, 2, 2, 10, 3, 5, 10};
并且有一个用户可以更改的数组(没有原始值的地方):
Object [] Misccount = new Object [Miscitems.length];
以下是实际表格的代码:
DefaultTableModel Miscmodel = new DefaultTableModel();
Miscmodel.addColumn("Item", Miscitems);
Miscmodel.addColumn("Volume of Item (Cubic Feet)", Miscdata);
Miscmodel.addColumn("Input Amount of Item", Misccount);
JTable Misctable = new JTable(Miscmodel);
JPanel panel7 = new JPanel();
panel7.add(Misctable);
panel7.add(new JScrollPane(Misctable));
以数组形式检索已更改数据的最佳方法是什么? (这是在它自己的专栏中)并且有一种简单的方法可以将数据更改为int[][]
数组吗?此外,用户在Misccount?