当前位置: 技术问答>java相关
swing中文显示为方框的问题
来源: 互联网 发布时间:2015-05-17
本文导语: 问题来源: swing中文显示为方框(win2000,j2sdk1.4.0) 本论坛解决办法有二: 1: 更改系统文件font.properties.zh,font.properties.zh.NT,照方 抓药,不起泡; 2:用xxx.setFont(new Font("宋体",0,12)); 可解决部分问...
问题来源:
swing中文显示为方框(win2000,j2sdk1.4.0)
本论坛解决办法有二:
1: 更改系统文件font.properties.zh,font.properties.zh.NT,照方
抓药,不起泡;
2:用xxx.setFont(new Font("宋体",0,12));
可解决部分问题,我试过JMenu,Jtable,但比较麻烦,需要一级一级往下
设置.
但JOptionPane却总不行,代码如下:
public void jMenuJobDelete_actionPerformed(ActionEvent e,Frame frame) {
frame.setFont(new Font("宋体",0,12));
int selectedIndex;
Object[] options = {"是",
"否"};
JOptionPane pane = new JOptionPane(
"要删除这个任务吗?",
JOptionPane.QUESTION_MESSAGE,
JOptionPane.YES_NO_OPTION,
null, //don't use a custom Icon
options, //the titles of buttons
options[1]); //default button title
pane.setFont(new Font("宋体",0,12));
JDialog dialog = pane.createDialog(frame, "请选择");
dialog.setFont(new Font("宋体",0,12));
dialog.show();
Object selectedValue = pane.getValue();
for(int counter = 0, maxCounter = options.length;
counter
swing中文显示为方框(win2000,j2sdk1.4.0)
本论坛解决办法有二:
1: 更改系统文件font.properties.zh,font.properties.zh.NT,照方
抓药,不起泡;
2:用xxx.setFont(new Font("宋体",0,12));
可解决部分问题,我试过JMenu,Jtable,但比较麻烦,需要一级一级往下
设置.
但JOptionPane却总不行,代码如下:
public void jMenuJobDelete_actionPerformed(ActionEvent e,Frame frame) {
frame.setFont(new Font("宋体",0,12));
int selectedIndex;
Object[] options = {"是",
"否"};
JOptionPane pane = new JOptionPane(
"要删除这个任务吗?",
JOptionPane.QUESTION_MESSAGE,
JOptionPane.YES_NO_OPTION,
null, //don't use a custom Icon
options, //the titles of buttons
options[1]); //default button title
pane.setFont(new Font("宋体",0,12));
JDialog dialog = pane.createDialog(frame, "请选择");
dialog.setFont(new Font("宋体",0,12));
dialog.show();
Object selectedValue = pane.getValue();
for(int counter = 0, maxCounter = options.length;
counter