【发布时间】:2020-05-08 07:08:45
【问题描述】:
我的代码是这样的:
这是用于根据搜索创建JTable 的代码。
public void myMethod(){
table_6 = new JTable(dataModel);
JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setBounds(16, 170, 1000, 300);
frame.getContentPane().add(scrollPane);
scrollPane.setViewportView(table_6);
scrollPane.setVisible(true);
table_6.setFillsViewportHeight(true);
table_6.getTableHeader().setReorderingAllowed(false);
table_6.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
table_6.getColumnModel().setColumnSelectionAllowed(false);
table_6.getTableHeader().setResizingAllowed(false);
}
【问题讨论】:
-
您需要一种能够呈现字符的字体。设置字体是一项足够常见的任务
-
scrollPane.setBounds(16, 170, 1000, 300);1) Java GUI 必须在不同的操作系统、屏幕尺寸、屏幕分辨率等上使用不同语言环境中的不同 PLAF。因此,它们不利于像素完美布局。而是使用布局管理器,或combinations of them 以及white space 的布局填充和边框。 2) 为了尽快获得更好的帮助,edit 添加minimal reproducible example 或Short, Self Contained, Correct Example。在String中硬编码一些古吉拉特语文本。
标签: java swing fonts internationalization jtable