用netbeans运行一个GUI程序,按钮和标签上字体是乱码,其他的输出字体正常package gui_thread;import java.awt.*;
import java.awt.event.*;
import java.util.logging.Level;
import java.util.logging.Logger;/**
*
* @author Administrator
*/
public class Example9_10 { /**
* @param args the command line arguments
*/
public static void main(String[] args) {
new ThreadFrame();
}
}class ThreadFrame extends Frame implements ActionListener, Runnable { TextField text1, text2;
boolean boo;
Label label = new Label("欢迎使用本词典");
Button fast = new Button("加速");
Thread Scrollwords = null; public ThreadFrame() throws HeadlessException {
setLayout(new FlowLayout());
Scrollwords = new Thread(this);
text1 = new TextField(10);
text2 = new TextField(10);
add(text1);
add(text2);
add(fast);
add(label);
text1.addActionListener(this);
fast.addActionListener(this);
setBounds(100, 100, 400, 280);
setVisible(true);
addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Scrollwords.start(); } public void actionPerformed(ActionEvent e) {
if (text1.getText().equals("boy")) {
text2.setText("男孩");
} else if (text1.getText().equals("die")) {
boo = true;
} else {
text2.setText("没有该单词");
}
if (e.getSource() == fast) {
Scrollwords.interrupt();
}
} public void run() {
while (true) {
int x = label.getBounds().x;
int y = 120;
x = x + 5;
label.setLocation(x, y);
if (x > 380) {
x = 10;
label.setLocation(x, y);
}
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(ThreadFrame.class.getName()).log(Level.SEVERE, null, ex);
}
if (boo) {
return;
}
}
}
}
用netbeans运行后,按钮和标签的字体乱码。用别的运行工具就正常显示,我想应该是netbeans的配置问题
有哪个高手帮我解决一下啊谢谢啦!!!
import java.awt.event.*;
import java.util.logging.Level;
import java.util.logging.Logger;/**
*
* @author Administrator
*/
public class Example9_10 { /**
* @param args the command line arguments
*/
public static void main(String[] args) {
new ThreadFrame();
}
}class ThreadFrame extends Frame implements ActionListener, Runnable { TextField text1, text2;
boolean boo;
Label label = new Label("欢迎使用本词典");
Button fast = new Button("加速");
Thread Scrollwords = null; public ThreadFrame() throws HeadlessException {
setLayout(new FlowLayout());
Scrollwords = new Thread(this);
text1 = new TextField(10);
text2 = new TextField(10);
add(text1);
add(text2);
add(fast);
add(label);
text1.addActionListener(this);
fast.addActionListener(this);
setBounds(100, 100, 400, 280);
setVisible(true);
addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Scrollwords.start(); } public void actionPerformed(ActionEvent e) {
if (text1.getText().equals("boy")) {
text2.setText("男孩");
} else if (text1.getText().equals("die")) {
boo = true;
} else {
text2.setText("没有该单词");
}
if (e.getSource() == fast) {
Scrollwords.interrupt();
}
} public void run() {
while (true) {
int x = label.getBounds().x;
int y = 120;
x = x + 5;
label.setLocation(x, y);
if (x > 380) {
x = 10;
label.setLocation(x, y);
}
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(ThreadFrame.class.getName()).log(Level.SEVERE, null, ex);
}
if (boo) {
return;
}
}
}
}
用netbeans运行后,按钮和标签的字体乱码。用别的运行工具就正常显示,我想应该是netbeans的配置问题
有哪个高手帮我解决一下啊谢谢啦!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货