View Javadoc

1   package org.catacomb.druid.swing;
2   
3   import java.awt.CardLayout;
4   import java.awt.Dimension;
5   import java.awt.Rectangle;
6   
7   import javax.swing.Scrollable;
8   
9   
10  public class DScrollablePanel extends DPanel implements Scrollable {
11      private static final long serialVersionUID = 1L;
12      CardLayout cardLayout;
13  
14  
15      public DScrollablePanel() {
16          super();
17      }
18  
19  
20      public Dimension getPreferredScrollableViewportSize() {
21          return getPreferredSize();
22      }
23  
24      public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
25          return 25;
26      }
27  
28      public boolean getScrollableTracksViewportHeight() {
29          return false;
30      }
31  
32      public boolean getScrollableTracksViewportWidth() {
33          return true;
34      }
35  
36      public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
37          return 25;
38      }
39  
40  
41      public void setCardLayout() {
42          cardLayout = new CardLayout();
43          setLayout(cardLayout);
44      }
45  
46  
47      public void nextCard() {
48          cardLayout.next(this);
49      }
50  
51  
52      public void showCard(String s) {
53          cardLayout.show(this, s);
54      }
55  }