source: josm/trunk/src/org/openstreetmap/josm/gui/widgets/VerticallyScrollablePanel.java@ 11941

Last change on this file since 11941 was 11941, checked in by Don-vip, 7 years ago

sonar - fb-contrib:IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES - Style - Method uses IDE generated parameter names

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.widgets;
3
4import java.awt.Dimension;
5import java.awt.LayoutManager;
6import java.awt.Rectangle;
7
8import javax.swing.JPanel;
9import javax.swing.JScrollPane;
10import javax.swing.Scrollable;
11
12import org.openstreetmap.josm.gui.util.GuiHelper;
13
14public class VerticallyScrollablePanel extends JPanel implements Scrollable {
15
16 /**
17 * Constructs a new {@code VerticallyScrollablePanel}.
18 */
19 public VerticallyScrollablePanel() {
20 super();
21 }
22
23 /**
24 * Constructs a new {@code VerticallyScrollablePanel}.
25 * @param isDoubleBuffered a boolean, true for double-buffering, which
26 * uses additional memory space to achieve fast, flicker-free updates
27 */
28 public VerticallyScrollablePanel(boolean isDoubleBuffered) {
29 super(isDoubleBuffered);
30 }
31
32 /**
33 * Constructs a new {@code VerticallyScrollablePanel}.
34 * @param layout the LayoutManager to use
35 * @param isDoubleBuffered a boolean, true for double-buffering, which
36 * uses additional memory space to achieve fast, flicker-free updates
37 */
38 public VerticallyScrollablePanel(LayoutManager layout, boolean isDoubleBuffered) {
39 super(layout, isDoubleBuffered);
40 }
41
42 /**
43 * Constructs a new {@code VerticallyScrollablePanel}.
44 * @param layout the LayoutManager to use
45 */
46 public VerticallyScrollablePanel(LayoutManager layout) {
47 super(layout);
48 }
49
50 /**
51 * Returns a vertical scrollable {@code JScrollPane} containing this panel.
52 * @return the vertical scrollable {@code JScrollPane}
53 * @since 6666
54 */
55 public final JScrollPane getVerticalScrollPane() {
56 return GuiHelper.embedInVerticalScrollPane(this);
57 }
58
59 @Override
60 public Dimension getPreferredScrollableViewportSize() {
61 return getPreferredSize();
62 }
63
64 @Override
65 public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
66 return 20;
67 }
68
69 @Override
70 public boolean getScrollableTracksViewportHeight() {
71 return false;
72 }
73
74 @Override
75 public boolean getScrollableTracksViewportWidth() {
76 return true;
77 }
78
79 @Override
80 public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
81 return 10;
82 }
83}
Note: See TracBrowser for help on using the repository browser.