本文整理汇总了Java中javax.swing.Scrollable类的典型用法代码示例。如果您正苦于以下问题:Java Scrollable类的具体用法?Java Scrollable怎么用?Java Scrollable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scrollable类属于javax.swing包,在下文中一共展示了Scrollable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBlockIncrement
import javax.swing.Scrollable; //导入依赖的package包/类
public int getBlockIncrement(int direction)
{
JViewport vp = scroll.getViewport();
if(blockIncrementSet || vp == null)
{
return super.getBlockIncrement(direction);
}
else if(vp.getView() instanceof Scrollable)
{
Scrollable view = (Scrollable)(vp.getView());
Rectangle vr = vp.getViewRect();
return view.getScrollableBlockIncrement(vr, getOrientation(), direction);
}
else if(getOrientation() == VERTICAL)
{
return vp.getExtentSize().height;
}
else
{
return vp.getExtentSize().width;
}
}
示例2: performNonScrollableTest
import javax.swing.Scrollable; //导入依赖的package包/类
/**
* Ensures that OverlayHelper will NOT implement the Scrollable interface if the view component does not implement
* the Scrollable interface.
*
* @throws Exception
*/
private void performNonScrollableTest() throws Exception {
final JPanel view = new JPanel(new BorderLayout());
final JComponent overlay = createTestOverlay();
final JComponent someField = createTestComponent();
OverlayHelper.attachOverlay(overlay, someField, 0, 0, 0);
view.add(someField);
final JScrollPane scrollPane = new JScrollPane(view);
waitUntilEventQueueIsEmpty();
final Component viewportView = scrollPane.getViewport().getView();
// assertFalse(viewportView == view);
assertFalse(viewportView instanceof Scrollable);
}
示例3: preferredLayoutSize
import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public Dimension preferredLayoutSize(Container parent) {
Dimension dim = super.preferredLayoutSize(parent);
OutlineView ov = (OutlineView) parent;
int thsbPolicy = ov.treeHorizontalScrollBarPolicy;
if ((thsb != null) && (thsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (thsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
dim.height += thsb.getPreferredSize().height;
}
else {
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
viewSize = viewport.getViewSize();
view = viewport.getView();
}
if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
}
if (canScroll && (viewSize.width > extentSize.width)) {
dim.height += thsb.getPreferredSize().height;
}
}
}
}
return dim;
}
示例4: isEditorScrollable
import javax.swing.Scrollable; //导入依赖的package包/类
private boolean isEditorScrollable(PropertyPanel p) {
Component[] comps = p.getComponents();
for (int i = 0; i < comps.length; i++) {
if (comps[i] instanceof Scrollable || isInstanceOfTopComponent(comps[i])) {
return true;
}
}
return false;
}
示例5: getDefaultIncrement
import javax.swing.Scrollable; //导入依赖的package包/类
private int getDefaultIncrement() {
Component content = scrollPane.getViewport().getView();
Point position = scrollPane.getViewport().getViewPosition();
int increment = isHorizontal ? 30 : 8;
Dimension viewSize = scrollPane.getViewport().getExtentSize();
if( content instanceof Scrollable ) {
increment = ((Scrollable)content).getScrollableUnitIncrement( new Rectangle( position, viewSize ),
isHorizontal ? SwingConstants.HORIZONTAL : SwingConstants.VERTICAL,
isScrollLeft ? -1 : 1 );
}
return increment;
}
示例6: propertyChange
import javax.swing.Scrollable; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent ev)
{
// If home pane was garbage collected, remove this listener from preferences
HomePane homePane = this.homePane.get();
if (homePane == null)
{
((UserPreferences) ev.getSource())
.removePropertyChangeListener(UserPreferences.Property.FURNITURE_CATALOG_VIEWED_IN_TREE, this);
}
else
{
// Replace previous furniture catalog view by the new one
JComponent oldFurnitureCatalogView = this.furnitureCatalogView.get();
if (oldFurnitureCatalogView != null)
{
boolean transferHandlerEnabled = homePane.transferHandlerEnabled;
homePane.setTransferEnabled(false);
JComponent newFurnitureCatalogView = (JComponent) homePane.controller
.getFurnitureCatalogController().getView();
newFurnitureCatalogView.setComponentPopupMenu(oldFurnitureCatalogView.getComponentPopupMenu());
homePane.setTransferEnabled(transferHandlerEnabled);
JComponent splitPaneTopComponent = newFurnitureCatalogView;
if (newFurnitureCatalogView instanceof Scrollable)
{
splitPaneTopComponent = SwingTools.createScrollPane(newFurnitureCatalogView);
}
else
{
splitPaneTopComponent = newFurnitureCatalogView;
}
((JSplitPane) SwingUtilities.getAncestorOfClass(JSplitPane.class, oldFurnitureCatalogView))
.setTopComponent(splitPaneTopComponent);
this.furnitureCatalogView = new WeakReference<JComponent>(newFurnitureCatalogView);
}
}
}
示例7: getUnitIncrement
import javax.swing.Scrollable; //导入依赖的package包/类
public int getUnitIncrement(int direction)
{
JViewport vp = scroll.getViewport();
if(!unitIncrementSet && (vp != null) && (vp.getView() instanceof Scrollable))
{
Scrollable view = (Scrollable)(vp.getView());
Rectangle vr = vp.getViewRect();
return view.getScrollableUnitIncrement(vr, getOrientation(), direction);
}
else
{
return Theme.plainFont().getSize() * scrollLineCount;
}
}
示例8: getPreferredScrollableViewportSize
import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public Dimension getPreferredScrollableViewportSize() {
if (master instanceof Scrollable) {
return ((Scrollable) master).getPreferredScrollableViewportSize();
}
return getPreferredSize();
}
示例9: getScrollableBlockIncrement
import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public int getScrollableBlockIncrement(Rectangle visibleRect,
int orientation, int direction) {
if (master instanceof Scrollable) {
return ((Scrollable) master).getScrollableBlockIncrement(visibleRect, orientation, direction);
}
return visibleRect.height;
}
示例10: getScrollableTracksViewportHeight
import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public boolean getScrollableTracksViewportHeight() {
if (master instanceof Scrollable) {
return ((Scrollable) master).getScrollableTracksViewportHeight();
}
return false;
}
示例11: getScrollableTracksViewportWidth
import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public boolean getScrollableTracksViewportWidth() {
if (master instanceof Scrollable) {
return ((Scrollable) master).getScrollableTracksViewportWidth();
}
return false;
}
示例12: getScrollableUnitIncrement
import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public int getScrollableUnitIncrement(Rectangle visibleRect,
int orientation, int direction) {
if (master instanceof Scrollable) {
return ((Scrollable) master).getScrollableUnitIncrement(visibleRect, orientation, direction);
}
return visibleRect.height / 10;
}
示例13: getScrollableUnitIncrement
import javax.swing.Scrollable; //导入依赖的package包/类
/**
* Obtine unitatea cu care se face scroll
* @param visibleRect
* @param orientation
* @param direction
* @return
*/
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
if (component instanceof Scrollable) {
return ((Scrollable) component)
.getScrollableUnitIncrement(visibleRect, orientation, direction);
} else {
return 10;
}
}
示例14: getScrollableBlockIncrement
import javax.swing.Scrollable; //导入依赖的package包/类
/**
* Obtine marimea blocului de scroll
* @param visibleRect
* @param orientation
* @param direction
* @return
*/
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
if (component instanceof Scrollable) {
return ((Scrollable) component)
.getScrollableBlockIncrement(visibleRect, orientation, direction);
} else {
return 10;
}
}
示例15: getScrollableTracksViewportWidth
import javax.swing.Scrollable; //导入依赖的package包/类
/**
* Obtine boolean daca viewportul va incerca sa mareasca width-ul
* containerul sau va folosi scroll
* @return
*/
public boolean getScrollableTracksViewportWidth() {
if (component instanceof Scrollable) {
return ((Scrollable) component)
.getScrollableTracksViewportWidth();
} else {
return false;
}
}