Java JEditorPane scrollToTop(JEditorPane editor)

Here you can find the source of scrollToTop(JEditorPane editor)

Description

scroll To Top

License

Apache License

Declaration

public static void scrollToTop(JEditorPane editor) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.swing.*;

public class Main {
    public static void scrollToTop(JScrollPane scrollPane) {
        final JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
        verticalScrollBar.setValue(verticalScrollBar.getMinimum());
    }//from w w w  .j a va  2 s. c o  m

    public static void scrollToTop(JEditorPane editor) {
        editor.setSelectionStart(0);
        editor.setSelectionEnd(0);
    }
}

Related

  1. getImage(JEditorPane editor, Color transparentColor)
  2. initHtmlComponent(JEditorPane editorPane)
  3. installTextStyle(JEditorPane control, String styleName)
  4. panelForHtml(JEditorPane editorPane)
  5. scrollToTop(final JEditorPane editor)
  6. setDefaultFontToEditorPane(JEditorPane editor, boolean justify)
  7. SetEditorProperties(JEditorPane editor, String text)
  8. setJEditorPaneBackground(javax.swing.JEditorPane jEditorPane, Color color)
  9. setParagraphAttributes(final AttributeSet attr, final boolean replace, final JEditorPane editorPane, final StyledDocument doc)