4

私はJava7に取り組んでいます。HTMLタグを使用してテキストをフォーマットしようとしています。私はテキストをに渡します

JTextField text = new JTextField();
text.setText("<html><body><p>The program performs encryption operations on the following ciphers: </p></body></html>");

ただし、プログラムはHTMLタグも出力します。そのテキストのサンプルは単なる例です。何が問題なのでしょう?乾杯

4

1 に答える 1

11

JTextFieldHTMLをサポートしていません。代わりに使用できますJTextPane

JTextPane text = new JTextPane();
text.setContentType("text/html");
text.setText("<html><body><p>The program performs encryption operations on the following ciphers: </p></body></html>");
于 2012-09-01T22:05:30.913 に答える