Here you can find the source of setDefaultScrollbarUnits(JScrollPane scrollPane)
Parameter | Description |
---|---|
scrollPane | a parameter |
public static void setDefaultScrollbarUnits(JScrollPane scrollPane)
//package com.java2s; /*/*from w ww .j a va2 s. co m*/ This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the license, or (at your option) any later version. */ import javax.swing.*; public class Main { /** * Set reasonable unit increments for a scroll pane that does not contain a * <tt>Scrollable</tt>. * * @param scrollPane */ public static void setDefaultScrollbarUnits(JScrollPane scrollPane) { int unit = new JLabel().getFont().getSize() * 2; scrollPane.getHorizontalScrollBar().setUnitIncrement(unit); scrollPane.getVerticalScrollBar().setUnitIncrement(unit); } }