我有2个问题,我需要问,第一个如何获取我的JTable的水平滚动,目前它收缩所有根本不可读的列.我有20列显示在表中.
2,如何将我的桌子高度宽度调整到我的屏幕尺寸.
我目前的代码是
Container cp = getContentPane();
ConnectionDB con = new ConnectionDB();
tableModel = con.getRecord(DEFAULT_QUERY);
table = new JTable(tableModel);
table.setPreferredScrollableViewportSize(new Dimension(900, 500));
table.setFont(new Font("Tahoma", Font.PLAIN, 12));
scrollPane = new JScrollPane(table);
centerPanel.add(scrollPane, BorderLayout.CENTER);
centerPanel.setBorder(BorderFactory.createTitledBorder("Books:"));
cp.add("Center", centerPanel);
Run Code Online (Sandbox Code Playgroud)
请帮助我,谢谢你提前.