English 中文(简体)
UTF-8和JTextArea
原标题:UTF-8 and JTextArea
  • 时间:2010-05-20 05:51:58
  •  标签:
  • java

i 有2个JTextArea,其中1个载有统法协会编码标准点,如这一u0645,想另1个JTextArea

显示统法协会编码点的特征。 但是,在将这一法典提交JTextArea时,它显示:

法典不明确,如果一成文法指JTextArea setText法,它就可直接操作。

为什么? 谁可以把《刑法》的“强点”从JTextArea传递到另一个?

感谢

问题回答

该守则具有特性,在其他文本领域,对应的“统一编码”对应法:

import java.awt.*;

import javax.swing.*;
public class FrameTest {
    public static void main(String[] args) {
        JFrame jf = new JFrame("Demo");
        Container cp = jf.getContentPane();
        cp.setLayout(new BorderLayout());
        JTextArea ta1 = new JTextArea(20, 20);
        JTextArea ta2 = new JTextArea(20, 20);
        Character c =  u0645 ;
        ta1.setText("" + c);
        String s = String.format("\%04x", (int) c.charValue());
        ta2.setText(s);
        cp.add(ta1, BorderLayout.WEST);
        cp.add(ta2, BorderLayout.EAST);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setSize(500, 100);
        jf.setVisible(true);
    }
}

“enterography


因此,如果你有这么长的此类特征,那么你需要<>通过特性说明的流体”(,(使用getCharAt(int)getChars(),处理每一特性的String.format(>/%04x)(int) c.charValue());,并将结果与目标指示相匹配。 (先使用<代码>StringBuffer)

JTextArea text=new JTextArea();

String dir=text.getText();

JTextArea text2=new  JTextArea();

text2.setText(dir);

但是,这并不奏效,而是含有一些法典要点。 直接通过密码

它的工作!





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...