gpt4 book ai didi

java - Swing 台 - 行

转载 作者:行者123 更新时间:2023-12-01 05:50:54 25 4
gpt4 key购买 nike

我必须构建一个包含一列、恰好 24 行的表格,并具有添加更多列的功能。每行必须有一个特定的高度,这是我使用单元格渲染器实现的。问题是 21 行缩小了,当我添加一列时,它看起来很好。有什么问题吗?

最佳答案

JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTable table = new JTable();
JTable table = new JTable();

table.setRowHeight(32);
table.setModel(new DefaultTableModel() {
public int getColumnCount() { return 1; }
public int getRowCount() { return 24;}
public Object getValueAt(int row, int col) { return "Your content" }
});
frame.add(table);
frame.pack();
frame.setEnabled(true);
frame.setVisible(true);

关于java - Swing 台 - 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4723016/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com