Article View: cn.bbs.comp.lang.java
Article #24337Re: �� Visual Cafe pro �в������뺺�֣�
From: �յ�
Date: Mon, 16 Mar 1998 00:00
Date: Mon, 16 Mar 1998 00:00
56 lines
3976 bytes
3976 bytes
���� wrote:
>
> why ?
>
> --
> [44m[33m ��������������������������
> [44m[33m �����Ӣ����ǧ������Ȼ��
> [44m[33m ��������������������������
>
> �� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
VCafe2.0���������
��ʵ�ϣ�VCafe2.0�Ѿ�֧���˵��ػ���JDK
1.1�У��Ѷ���������unicode��ʽ���б��룬
�������ճ����õĺ�����ȴ��GB�롣��ִ��һЩ�������ʾStringʱ��VCafe2.0���Ѿ�
�ܹ���unicode�뼴ʱ��װJVM����ƽ̨������ת���ɵ����룬��ȴû���������ƣ�����
�������������棺
����ת���˵ģ�
1. System.out.println()
2. һЩ�ؼ���Label��Button
û�н���ת���ģ�
�ؼ�TextField��TextArea��
�����ʱ������Label��Text��Button��Label���ó������֣���������ƻ�������ʱ��
������ʾ������ģ�����TextField��TextArea��Text�������ó����ģ����������
������ʱ����������ʾ����++??��֮�����������������Ϊ��Label��Button��
setLabel()��setText()�����Ѿ���unicode��ת�����˵����룬��TextField��TextArea��
setText()����ȴû�н���ת����JVM�����ʾ�����������ַ��unicode��������
֪������Щ���ͺð��ˡ�
�������������Label��Button��TextField��TextArea����ϸ�������룬����Label��
Button����ʾ���ݳ�ʼ���ö��ڹ��췽�������ã���TextField��TextArea�ij�ʼ��ȴ
�ֱ����䷽��setText()��init ()�����á���ʱ��Ҫ��������ù�̽����ģ�
������һ��TextField�Ŀؼ�tf����������Ʋ��ϣ���init ()��������һ�δ��룺
tf = new java.awt.TextField();
tf.setText("����");
tf.setBounds(0,0,100,25);
add(tf);
����δ�������ģ��ij����·�����
tf = new java.awt.TextField();
// tf.setText("����");
String str1=new String ("����"), str2=new String ("");
try {
byte[] a = str1.getBytes ("8859_1"); //��str1�еĴ���ת����������
str2 = new String (a, "GB2312"); //��ת���ɹ����
}catch(UnsupportedEncodingException e){
}
tf.setText (str2);
tf.setBounds(0,0,100,25);
add(tf);
���潫str1������unicodeת�����ģ�ASCII��unicode��һ���Ӽ���������ԭ���ı��뷽
ʽ��Ȼ��ͨ��new String (a, "GB2312")��ASCII��ת��GB�롣
����˼���ǣ��⼸�����getText()������ȷ�ġ�
Technical Details
Message-ID:
<350CFA64.667EFA9B@bbs.tsinghua.edu.cn>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<980310.yCEjk$PBBS@bbs.ustc.edu.cn>Show Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB X-Google-Thread: f6cb0,153f0e6d16d8f3c2 X-Google-Attributes: gidf6cb0,public From: "�յ�" <midi.bbs@bbs.tsinghua.edu.cn> Subject: Re: �� Visual Cafe pro �в������뺺�֣� Date: 1998/03/16 Message-ID: <350CFA64.667EFA9B@bbs.tsinghua.edu.cn> X-Deja-AN: 334502445 Content-Transfer-Encoding: 8bit References: <980310.yCEjk$PBBS@bbs.ustc.edu.cn> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Organization: �廪��ѧ Newsgroups: cn.bbs.comp.lang.java