Re: Problem copying JTextPane to clipboard when using foreign characters.
On 4/18/2011 4:43 PM, Deva wrote:
in some language like chineese , korian , text not getting displayed
properly in jtextpane in java swing.
Here is my SSCCE. It seems to work. Does it work for you? It displays
the first two characters on this table:
<http://www.i18nguy.com/unicode/hiragana.html>
package test;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.SwingUtilities;
/**
*
* @author Brenden Towey
*/
public class JapaneseText {
public static void main( String[] args )
{
SwingUtilities.invokeLater( new Runnable() {
public void run()
{
constructGUI();
}
} );
}
private static void constructGUI() {
JFrame frame = new JFrame();
JTextPane tp = new JTextPane();
JScrollPane scrollPane = new JScrollPane( tp );
frame.add( scrollPane );
String jp = "\u3042\u3044";
tp.setText( jp );
frame.pack();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setLocationRelativeTo( null );
frame.setVisible( true );
}
}