1
私のコードはJPanel
のJTabel
です。私は現在、サイズ変更の問題に遭遇しています。それはちょうどGUIのWESTを占めており、私はそれが左下を占めるようにしようとしています。JPanelにあるJTableのサイズを変更
public void table(JFrame f)
{
String[] columnNames = {"First Name", "Last Name"};
Object[][] players = {
{"John", "Doe"},
{"Steve", "White"}
};
JTable table = new JTable(players, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
table.setFillsViewportHeight(true);
JPanel container = new JPanel();
container.setPreferredSize(new Dimension(50,300)); //This seems very wrong
container.setLayout(new BorderLayout());
container.add(table.getTableHeader(), BorderLayout.PAGE_START);
container.add(table, BorderLayout.WEST);
f.add(container);
f.revalidate();