當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。