2
我有下面的代碼中添加HTML到JEditorPane如何在JEditorPane clikcable中添加錨標記? (JAVA)
JEditorPane content = new JEditorPane();
content.setEditable(false);
content.setContentType("text/html");
content.setText(resultText);
JScrollPane bottomScrollPane = new JScrollPane(content);
bottomScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
bottomScrollPane.setBorder(BorderFactory.createTitledBorder("Swing Rendered"));
這一步後,我已經添加了JEditorPane的實例「內容」到一個JPanel實例和 可以能夠完美地看到結果。但是當我嘗試點擊顯示的鏈接時,它不起作用。
如何使這些鏈接可點擊,並且它應該將用戶重定向到瀏覽器中的特定網址?
問候, 巴蘭
我試過這段代碼,我想讓鏈接在瀏覽器窗口中打開..不是內嵌在窗格中.. – balanv 2013-03-14 10:30:36
@balanv請參閱編輯 – 2013-03-14 10:33:50
非常感謝.. +1 for swift help .. – balanv 2013-03-14 10:54:04