java图形应用在Turbo linux下的中文乱码问题

1、在jre/lib/目录下建立font.Turbo.properties文件:

version=1

# Component Font Mappings

serif.plain.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
serif.bold.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
serif.italic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
serif.bolditalic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
sansserif.plain.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
sansserif.bold.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
sansserif.italic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
sansserif.bolditalic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
monospaced.plain.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
monospaced.bold.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
monospaced.italic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
monospaced.bolditalic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
dialog.plain.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
dialog.bold.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
dialog.italic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
dialog.bolditalic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
dialoginput.plain.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
dialoginput.bold.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
dialoginput.italic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0
dialoginput.bolditalic.zh-1=Simsun GB-medium-r-normal--0-0-0-0-c-0-gb2312.1988-0

# Search Sequences

sequence.allfonts=zh-1

# Exclusion Ranges

# Font File Names

 

2、把windows\system32\simsun.ttc 拷贝到jre/lib/fonts目录下

3、在java程序中,输出中文字符必须指定字符集,比如宋体;

              public   void   paintComponent   (Graphics   g) 
              { 
                      super.paintComponent(g); 
                      g.setFont(new Font("宋体",Font.PLAIN,12));
                      g.drawString("传入的杭州萧山",20,30); 

 

              }

你可能感兴趣的:(java,C++,c,linux,C#)