请教一下:我现在想用UIManager.setLookAndFeel()来设置我的swing外观,如果用motif,metal,system三种自带的则可以正常显示中文,但是我如果用下载的其他的则不能正常显示中文,显示的是小方框.例如我用setLookAndFeel("net.sourceforge.napkinlaf.NapkinLookAndFeel"),之后添加一个(new JButton("你好")),不能正常显示,英文正常.
请问这个问题怎么解决啊?
非常感谢!
请问这个问题怎么解决啊?
非常感谢!
继承需要的theme,重写里头的getFont方法。
返回字体名为“Dialog”(当然,你使用中文字体:“宋体”....也行,但是兼容性不好)的字体。
能说详细点吗?yonghar(ohno) ( ) 信誉:105
请问这个Inf包是哪里的包? 下载的那个JAR里面没有这个包那个LookAndFeel JAR的下载地址是:
http://jaist.dl.sourceforge.net/sourceforge/napkinlaf/napkinlaf-jars-1.0_001.zippublic class TestNapkin extends JFrame {
public TestNapkin(){
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
cp.add(new JButton("hello"));
cp.add(new JButton(getChineseOut("你好!")));
}
public static void main(String[]args){
try{
UIManager.setLookAndFeel("net.sourceforge.napkinlaf.NapkinLookAndFeel");
}catch(Exception e){}
TestNapkin frame = new TestNapkin();
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
frame.setSize(300,200);
frame.setVisible(true);
}
}