我用Java写的Applet为什么不能显示中文? 使用的jdk版本是多少?描述一下自己机器的软件环境和原码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jdk版本是1.4.0我用的是Windows2000 Professionalimport java.awt.*;import java.applet.*;import java.awt.event.*;public class frame extends Applet implements ActionListener{ public input_frame a_frame; public Button b_open,b_close; public TextArea the_message; boolean frame_visible; public void init() { b_open = new Button("打开 frame"); add(b_open); b_open.addActionListener(this); b_close = new Button("关闭 frame"); add(b_close); b_close.addActionListener(this); the_message = new TextArea(5,20); add(the_message); frame_visible = false; a_frame = create_dialog("Input:\n"); } public input_frame create_dialog(String the_title) { a_frame = new input_frame(the_title,this); a_frame.setSize(250,200); return a_frame; } public void actionPerformed(ActionEvent ev) { String label = ev.getActionCommand(); if(label.equals("Open frame")&&(!frame_visible)) { a_frame.show(); frame_visible = true; } if(label.equals("Close frame")&&frame_visible) { a_frame.setVisible(false); frame_visible = false; } }}class input_frame extends Frame implements ActionListener{ Button close_frame; TextArea text_space; frame my_parent; input_frame(String the_title,frame host) { super(the_title); FlowLayout fl; my_parent = host; fl = new FlowLayout(); setLayout(fl); close_frame = new Button("Close frame"); add(close_frame); close_frame.addActionListener(this); text_space = new TextArea("Input:\n",5,10); add(text_space); } public synchronized void setVisible(boolean visible) { String the_input; the_input = text_space.getText(); my_parent.the_message.insert(the_input,0); my_parent.frame_visible = false; super.setVisible(visible); } public void actionPerformed(ActionEvent ev) { String label = ev.getActionCommand(); if(label.equals("Close frame")) setVisible(false); }}在DOS下编译,在执行后,就是乱码 我遇到的问题是:jdk1.4做的Applet在别的机器上能够看到中文。我自己的反而不能。都用的是XP+jdk1.4的plugin.搞不懂!!!! 我的也是1.4的,居然连编译都过不了 ,说是::illegal character: \65292 我没有遇到过中文问题,我都用swing 我这边没有问题。可能跟编译的Encoding有. 我这边测试没有问题,可能跟编译时的encoding有关.设置一下试试。 只要在每一个页面中都加入<%@ page contentType="text/html;charset=gb2312"%>就可以了! 搞错了,应该是<meta http-equiv="Content-Type" content="text/html; charset=GBK"/>还要注意大小写! Caibo(丰风) :怎么解决的?什么问题? 求解 java程序连接不上sql server 2000数据库 JTable问题? Applet显示图片小问题 发邮件的问题 java数据库中如何按照某个字段的顺序插入记录? 如何提取一个分数的分子,分母 初学者请教:关于swing的问题 连接数据库后,执行select为什么会出现"参数不足,期待是1"的错误? 100分,java.sql.SQLException: 耗損的結果集,實在搞不定,求各位幫忙。 关于创建对象的问题求问 搜索引擎 各位大虾帮帮忙,请教一下JTable怎么用,请懂得的点拔以下!
import java.applet.*;
import java.awt.event.*;public class frame extends Applet implements ActionListener
{
public input_frame a_frame;
public Button b_open,b_close;
public TextArea the_message;
boolean frame_visible;
public void init()
{
b_open = new Button("打开 frame");
add(b_open);
b_open.addActionListener(this);
b_close = new Button("关闭 frame");
add(b_close);
b_close.addActionListener(this);
the_message = new TextArea(5,20);
add(the_message);
frame_visible = false;
a_frame = create_dialog("Input:\n");
} public input_frame create_dialog(String the_title)
{
a_frame = new input_frame(the_title,this);
a_frame.setSize(250,200);
return a_frame;
} public void actionPerformed(ActionEvent ev)
{
String label = ev.getActionCommand(); if(label.equals("Open frame")&&(!frame_visible))
{
a_frame.show();
frame_visible = true;
} if(label.equals("Close frame")&&frame_visible)
{
a_frame.setVisible(false);
frame_visible = false;
}
}
}class input_frame extends Frame implements ActionListener
{
Button close_frame;
TextArea text_space;
frame my_parent; input_frame(String the_title,frame host)
{
super(the_title);
FlowLayout fl;
my_parent = host;
fl = new FlowLayout();
setLayout(fl);
close_frame = new Button("Close frame");
add(close_frame);
close_frame.addActionListener(this);
text_space = new TextArea("Input:\n",5,10);
add(text_space);
} public synchronized void setVisible(boolean visible)
{
String the_input;
the_input = text_space.getText();
my_parent.the_message.insert(the_input,0);
my_parent.frame_visible = false;
super.setVisible(visible);
} public void actionPerformed(ActionEvent ev)
{
String label = ev.getActionCommand();
if(label.equals("Close frame"))
setVisible(false);
}
}在DOS下编译,在执行后,就是乱码
illegal character: \65292