KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > welcome > content > NoHorizontalScrollPanel


1 package org.netbeans.modules.welcome.content;
2
3 import java.awt.Dimension JavaDoc;
4 import java.awt.GridBagLayout JavaDoc;
5 import java.awt.Rectangle JavaDoc;
6 import javax.swing.JPanel JavaDoc;
7 import javax.swing.Scrollable JavaDoc;
8
9
10 public class NoHorizontalScrollPanel extends JPanel JavaDoc implements Scrollable JavaDoc {
11     public NoHorizontalScrollPanel() {
12         super(new GridBagLayout JavaDoc());
13     }
14
15     public Dimension JavaDoc getPreferredScrollableViewportSize() {
16         return super.getPreferredSize();
17     }
18
19     public int getScrollableUnitIncrement(Rectangle JavaDoc visibleRect, int orientation, int direction) {
20         return Utils.getDefaultFontSize();
21     }
22
23     public int getScrollableBlockIncrement(Rectangle JavaDoc visibleRect, int orientation, int direction) {
24         return 10 * Utils.getDefaultFontSize();
25     }
26
27     public boolean getScrollableTracksViewportWidth() {
28         return true;
29     }
30
31     public boolean getScrollableTracksViewportHeight() {
32         return false;
33     }
34 }
Popular Tags