Now that I managed to put the objects from a file into a ArrayList
, I have to display them into a JTable
.
These are the 3 objects contained in
Use your TableModel
to create a JTable
and add it to a JFrame
. Also consider overriding getColumnName()
, as shown here. See also How to Use Tables.
MonModel model = new MonModel();
JTable table = new JTable(model);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(new JScrollPane(table), BorderLayout.CENTER);
f.pack();
f.setLocationByPlatform(true);
f.setVisible(true);