我有2個問題,我需要問,1如何獲得我的JTable的水平滾動,目前它收縮所有不可讀的列。我有20列顯示在表中。如何獲得JTable的水平滾動
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);
請幫助我吧,先謝謝了。
對於水平滾動,使用'JScrollPane' – johnchen902 2013-05-03 09:43:15
@ johnchen902,這是JScrollPane的。如何獲得scoll? – 2013-05-03 09:44:43
爲了更快地獲得更好的幫助,請發佈[SSCCE](http://sscce.org/)。 – 2013-05-03 09:52:40