69 |
import javax.swing.JViewport; |
import javax.swing.JViewport; |
70 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
71 |
import javax.swing.Scrollable; |
import javax.swing.Scrollable; |
72 |
|
import javax.swing.SwingConstants; |
73 |
import javax.swing.Timer; |
import javax.swing.Timer; |
74 |
import javax.swing.TransferHandler; |
import javax.swing.TransferHandler; |
75 |
import javax.swing.UIManager; |
import javax.swing.UIManager; |
1131 |
|
|
1132 |
public Dimension getPreferredScrollableViewportSize() |
public Dimension getPreferredScrollableViewportSize() |
1133 |
{ |
{ |
1134 |
return null; |
return getPreferredSize(); |
1135 |
} |
} |
1136 |
|
|
1137 |
public int getScrollableUnitIncrement(Rectangle visible, int orientation, |
public int getScrollableUnitIncrement(Rectangle visible, int orientation, |
1138 |
int direction) |
int direction) |
1139 |
{ |
{ |
1140 |
return 0; |
// We return 1/10 of the visible area as documented in Sun's API docs. |
1141 |
|
if (orientation == SwingConstants.HORIZONTAL) |
1142 |
|
return visible.width / 10; |
1143 |
|
else if (orientation == SwingConstants.VERTICAL) |
1144 |
|
return visible.height / 10; |
1145 |
|
else |
1146 |
|
throw new IllegalArgumentException("orientation must be either " |
1147 |
|
+ "javax.swing.SwingConstants.VERTICAL " |
1148 |
|
+ "or " |
1149 |
|
+ "javax.swing.SwingConstants.HORIZONTAL" |
1150 |
|
); |
1151 |
} |
} |
1152 |
|
|
1153 |
public int getScrollableBlockIncrement(Rectangle visible, int orientation, |
public int getScrollableBlockIncrement(Rectangle visible, int orientation, |
1154 |
int direction) |
int direction) |
1155 |
{ |
{ |
1156 |
return 0; |
// We return the whole visible area as documented in Sun's API docs. |
1157 |
|
if (orientation == SwingConstants.HORIZONTAL) |
1158 |
|
return visible.width; |
1159 |
|
else if (orientation == SwingConstants.VERTICAL) |
1160 |
|
return visible.height; |
1161 |
|
else |
1162 |
|
throw new IllegalArgumentException("orientation must be either " |
1163 |
|
+ "javax.swing.SwingConstants.VERTICAL " |
1164 |
|
+ "or " |
1165 |
|
+ "javax.swing.SwingConstants.HORIZONTAL" |
1166 |
|
); |
1167 |
} |
} |
1168 |
|
|
1169 |
/** |
/** |