本文整理匯總了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;
}
}