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

Last change on this file since 3128 was 3083, checked in by bastiK, 14 years ago

added svn:eol-style=native to source files

  • Property svn:eol-style set to native
File size: 1.5 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
12public class VerticallyScrollablePanel extends JPanel implements Scrollable {
13
14 static public JScrollPane embed(VerticallyScrollablePanel panel) {
15 JScrollPane sp = new JScrollPane(panel);
16 sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
17 sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
18 return sp;
19 }
20
21 public VerticallyScrollablePanel() {
22 super();
23 }
24
25 public VerticallyScrollablePanel(boolean isDoubleBuffered) {
26 super(isDoubleBuffered);
27 }
28
29 public VerticallyScrollablePanel(LayoutManager layout, boolean isDoubleBuffered) {
30 super(layout, isDoubleBuffered);
31 }
32
33 public VerticallyScrollablePanel(LayoutManager layout) {
34 super(layout);
35 }
36
37 public Dimension getPreferredScrollableViewportSize() {
38 return getPreferredSize();
39 }
40
41 public int getScrollableBlockIncrement(Rectangle arg0, int arg1, int arg2) {
42 return 20;
43 }
44
45 public boolean getScrollableTracksViewportHeight() {
46 return false;
47 }
48
49 public boolean getScrollableTracksViewportWidth() {
50 return true;
51 }
52
53 public int getScrollableUnitIncrement(Rectangle arg0, int arg1, int arg2) {
54 return 10;
55 }
56}
Note: See TracBrowser for help on using the repository browser.