当前位置: 首页>>代码示例>>Java>>正文


Java Scrollable类代码示例

本文整理汇总了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;
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:23,代码来源:CScrollBar.java

示例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);
    }
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:24,代码来源:OverlayHelperTests.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:OutlineView.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:IndexedEditorPanel.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ScrollAction.java

示例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);
		}
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:37,代码来源:HomePane.java

示例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;
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:15,代码来源:CScrollBar.java

示例8: getPreferredScrollableViewportSize

import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public Dimension getPreferredScrollableViewportSize() {
    if (master instanceof Scrollable) {
        return ((Scrollable) master).getPreferredScrollableViewportSize();
    }
    return getPreferredSize();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:8,代码来源:CodeViewer.java

示例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;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:9,代码来源:CodeViewer.java

示例10: getScrollableTracksViewportHeight

import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public boolean getScrollableTracksViewportHeight() {
    if (master instanceof Scrollable) {
        return ((Scrollable) master).getScrollableTracksViewportHeight();
    }
    return false;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:8,代码来源:CodeViewer.java

示例11: getScrollableTracksViewportWidth

import javax.swing.Scrollable; //导入依赖的package包/类
@Override
public boolean getScrollableTracksViewportWidth() {
    if (master instanceof Scrollable) {
        return ((Scrollable) master).getScrollableTracksViewportWidth();
    }
    return false;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:8,代码来源:CodeViewer.java

示例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;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:9,代码来源:CodeViewer.java

示例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;
    }
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:16,代码来源:JScrollableBottomSpacingContainer.java

示例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;
    }
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:16,代码来源:JScrollableBottomSpacingContainer.java

示例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;
    }
}
 
开发者ID:genomeartist,项目名称:genomeartist,代码行数:14,代码来源:JScrollableBottomSpacingContainer.java


注:本文中的javax.swing.Scrollable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。