当在JEditorPane中设置的子类JFrame中的新文本时,我遇到问题。 package gui;
...
public class Index extends JFrame {
JEditorPane editorPaneMR = new JEditorPane();
public static void main(String[] args) {
...
}
我搜索的如何使可点击的链接中JEditorPane,我发现这个问题 Is it possible to create programs in Java that create text to link in Chrome? 这是非常有用的,但我的代码中使用重复声明 JEditorPane jep = new JEditorPane();
jep.setContentType("text/html
如何使用JEditorPane获取选定文本的索引? 我想在编辑器窗格中获取选定文本的起始和结束索引。 当我在编辑器窗格中选择文本时,编辑器窗格返回的索引与实际HTML文件中字符串的索引不同。当我选择单行文本时,两个索引都是相同的,但如果我选择多行,则索引是不同的。 我正在使用以下代码。 int start = editorpane.getSelectionStart();
int end = e
我使用JEditorPane在我的机器上显示一个html文件,这个html有一个名为“skip to main content”的链接,它将引导用户到同一页面的中间;但我希望它automaticaly滚动到页面的中间只是对话框设置可见,我试过JEditorPane.scrollToReference(),这是行不通的。 任何人都可以帮忙吗?