1 package org.netbeans.modules.welcome.content; 2 3 import java.awt.Dimension ; 4 import java.awt.GridBagLayout ; 5 import java.awt.Rectangle ; 6 import javax.swing.JPanel ; 7 import javax.swing.Scrollable ; 8 9 10 public class NoHorizontalScrollPanel extends JPanel implements Scrollable { 11 public NoHorizontalScrollPanel() { 12 super(new GridBagLayout ()); 13 } 14 15 public Dimension getPreferredScrollableViewportSize() { 16 return super.getPreferredSize(); 17 } 18 19 public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { 20 return Utils.getDefaultFontSize(); 21 } 22 23 public int getScrollableBlockIncrement(Rectangle 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 |