Java JScrollPane scrollToTop(JScrollPane scrollPane)

Here you can find the source of scrollToTop(JScrollPane scrollPane)

Description

scroll To Top

License

Apache License

Declaration

public static void scrollToTop(JScrollPane scrollPane) 

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.  ja v a  2  s.  c  om*/

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

Related

  1. resetScrollPane(final JScrollPane scrollPane)
  2. scrollToBottom(final JScrollPane scrollPane)
  3. scrolltoHomePosition(JScrollPane jScrollPane1)
  4. scrollToTop(final JScrollPane scroller, int delay)
  5. scrollToTop(final JScrollPane scrollPane)
  6. scrollToTopLater(final JScrollPane scrollPane)
  7. scrollToVisible(Component comp, JScrollPane parent)
  8. setDefaultScrollbarUnits(JScrollPane scrollPane)
  9. setScrollpane(JScrollPane scrollpane)