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

Last change on this file since 11921 was 11457, 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: 1.7 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 public VerticallyScrollablePanel(boolean isDoubleBuffered) {
24 super(isDoubleBuffered);
25 }
26
27 public VerticallyScrollablePanel(LayoutManager layout, boolean isDoubleBuffered) {
28 super(layout, isDoubleBuffered);
29 }
30
31 public VerticallyScrollablePanel(LayoutManager layout) {
32 super(layout);
33 }
34
35 /**
36 * Returns a vertical scrollable {@code JScrollPane} containing this panel.
37 * @return the vertical scrollable {@code JScrollPane}
38 * @since 6666
39 */
40 public final JScrollPane getVerticalScrollPane() {
41 return GuiHelper.embedInVerticalScrollPane(this);
42 }
43
44 @Override
45 public Dimension getPreferredScrollableViewportSize() {
46 return getPreferredSize();
47 }
48
49 @Override
50 public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
51 return 20;
52 }
53
54 @Override
55 public boolean getScrollableTracksViewportHeight() {
56 return false;
57 }
58
59 @Override
60 public boolean getScrollableTracksViewportWidth() {
61 return true;
62 }
63
64 @Override
65 public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) {
66 return 10;
67 }
68}
Note: See TracBrowser for help on using the repository browser.