[英]JTextField together with HTML tags
我正在使用Java 7.我正在嘗試使用HTML標簽格式化文本。 我把文字傳入
JTextField text = new JTextField();
text.setText("<html><body><p>The program performs encryption operations on the following ciphers: </p></body></html>");
但程序也打印HTML標簽。 那個文本樣本只是一個例子。 可能是什么問題? 干杯
JTextField
不支持HTML 。 你可以改用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>");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.