Answer the question
In order to leave comments, you need to log in
Why does it jump to the end of text when outputting to JEditorPane?
When displaying text, the skrullbar rolls to the end of the text, how can I make sure that nothing changes? More precisely, to show exactly the beginning of the text?
JEditorPane jEditorPane = new JEditorPane();
jEditorPane.setContentType("text/html");
jEditorPane.setFont(new Font("Arial", Font.PLAIN, 14));
JEditorPane jEditorPane1 = new JEditorPane();
jEditorPane1.setContentType("text/html");
jEditorPane1.setFont(new Font("Arial", Font.PLAIN, 14));
jEditorPane.setText(text);
JScrollPane jScrollPane = new JScrollPane(jEditorPane);
jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane.setPreferredSize(new Dimension(580, 620));
JScrollPane jScrollPane1 = new JScrollPane(jEditorPane1);
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane1.setPreferredSize(new Dimension(580, 620));
jPanelStart.add(jScrollPane);
jPanelEnd.add(jScrollPane1);
Answer the question
In order to leave comments, you need to log in
After uploading the textjEditorPane.setCaretPosition(тут догадаешься=) );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question