File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/main/java/org/scijava/ui/swing/console Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 3535import java .awt .Component ;
3636import java .awt .Dimension ;
3737import java .awt .Font ;
38+ import java .awt .FontMetrics ;
3839
3940import javax .swing .JPanel ;
4041import javax .swing .JScrollPane ;
@@ -179,6 +180,14 @@ private synchronized void initConsolePanel() {
179180
180181 scrollPane = new JScrollPane (textPanel );
181182 scrollPane .setPreferredSize (new Dimension (600 , 600 ));
183+
184+ // Make the scroll bars move at a reasonable pace.
185+ final FontMetrics fm = scrollPane .getFontMetrics (scrollPane .getFont ());
186+ final int charWidth = fm .charWidth ('a' );
187+ final int lineHeight = fm .getHeight ();
188+ scrollPane .getHorizontalScrollBar ().setUnitIncrement (charWidth );
189+ scrollPane .getVerticalScrollBar ().setUnitIncrement (2 * lineHeight );
190+
182191 panel .add (scrollPane );
183192
184193 consolePanel = panel ;
You can’t perform that action at this time.
0 commit comments