Topic: 为何汉字都显示为方框?

  Print this page

1.为何汉字都显示为方框? Copy to clipboard
Posted by: stevehoo
Posted on: 2004-06-28 14:47

import javax.swing.*;
import java.awt.*;

public class CreateFrame{
public static void main(String[] args){
String title = "Frame Title";
JFrame frame = new JFrame(title);
JLabel label = new JLabel("你好");
frame.getContentPane().add(label);
frame.setSize(300, 300);
frame.setVisible(true);
}
}
编译后运行,“你好”这两个汉字显示为方框,使用jdk 1.4.0。请问怎么解决

2.Re:为何汉字都显示为方框? [Re: stevehoo] Copy to clipboard
Posted by: dytiger
Posted on: 2004-06-29 01:44



JLabel label = new JLabel("你好");

后加

label.setFont(new Font("宋体",20,20));

试试

3.Re:为何汉字都显示为方框? [Re: stevehoo] Copy to clipboard
Posted by: stevehoo
Posted on: 2004-06-29 11:13

解决了,多谢多谢!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923