public class HiwayTest7 { public static void main(String...args){
JFrame frame = new JFrame("AdvancedJTable");
String[][] rowDatas = new String[][]{{"5","1","7","4"},{"11","0","9","3"}};
String[] columnDatas = new String[]{"A","B","C","D"};
JTable table = new JTable(rowDatas,columnDatas);
table.removeColumn(new TableColumn(1));
// table.setPreferredSize(new Dimension(800,300));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.updateUI();
frame.setContentPane(new JScrollPane(table));
frame.setBounds(new Rectangle(10,10,800,600));
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}Hello,every body :
run the application above, we can use mouse to resize the columns' size, if we make the commented line uncommented, it becomes hard to resize column'size by mouse(it seems resize doesn't work,but sometimes we can resize uncontrollably).Can you tell me why ? Thank you
呵呵,我是中国人,想锻炼下e文不过,这些英文都是常见的词语,静下心来看不难的3Q
// table.setPreferredSize(new Dimension(800,300));
这句注不注释 对 拖动列宽的影响多谢