當前位置: 首頁>>代碼示例>>Java>>正文


Java Scrollbar類代碼示例

本文整理匯總了Java中java.awt.Scrollbar的典型用法代碼示例。如果您正苦於以下問題:Java Scrollbar類的具體用法?Java Scrollbar怎麽用?Java Scrollbar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Scrollbar類屬於java.awt包,在下文中一共展示了Scrollbar類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeImpl

import java.awt.Scrollbar; //導入依賴的package包/類
@Override
void initializeImpl() {
    super.initializeImpl();
    final Scrollbar target = getTarget();
    setLineIncrement(target.getUnitIncrement());
    setPageIncrement(target.getBlockIncrement());
    setValues(target.getValue(), target.getVisibleAmount(),
              target.getMinimum(), target.getMaximum());

    final int orientation = target.getOrientation();
    final JScrollBar delegate = getDelegate();
    synchronized (getDelegateLock()) {
        delegate.setOrientation(orientation == Scrollbar.HORIZONTAL
                                ? Adjustable.HORIZONTAL
                                : Adjustable.VERTICAL);
        delegate.addAdjustmentListener(this);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:LWScrollBarPeer.java

示例2: shouldFocusOnClick

import java.awt.Scrollbar; //導入依賴的package包/類
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? acc.getPeer(component) : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick && acc.canBeFocusOwner(component);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:27,代碼來源:KeyboardFocusManagerPeerImpl.java

示例3: getClickPoint

import java.awt.Scrollbar; //導入依賴的package包/類
@Override
protected Point getClickPoint(ComponentOperator oper, int direction, int orientation) {
    int x, y;
    if (orientation == Scrollbar.HORIZONTAL) {
        if (direction == ScrollAdjuster.INCREASE_SCROLL_DIRECTION) {
            x = oper.getWidth() - 1 - CLICK_OFFSET;
        } else if (direction == ScrollAdjuster.DECREASE_SCROLL_DIRECTION) {
            x = CLICK_OFFSET;
        } else {
            return null;
        }
        y = oper.getHeight() / 2;
    } else if (orientation == Scrollbar.VERTICAL) {
        if (direction == ScrollAdjuster.INCREASE_SCROLL_DIRECTION) {
            y = oper.getHeight() - 1 - CLICK_OFFSET;
        } else if (direction == ScrollAdjuster.DECREASE_SCROLL_DIRECTION) {
            y = CLICK_OFFSET;
        } else {
            return null;
        }
        x = oper.getWidth() / 2;
    } else {
        return null;
    }
    return new Point(x, y);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:27,代碼來源:ScrollbarDriver.java

示例4: ClimaticPopInitialiser

import java.awt.Scrollbar; //導入依賴的package包/類
public ClimaticPopInitialiser(int population) {
    populationSize = population;
    panel = new Panel();
    panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    populationLabel = new Label(Integer.toString(populationSize));
    panel.add(new Label("Population Size", Label.RIGHT));
    panel.add(new Scrollbar(Scrollbar.HORIZONTAL, populationSize, 1,
                            MIN_POPULATION_SIZE, MAX_POPULATION_SIZE) {
        {
            addAdjustmentListener(new AdjustmentListener() {
                public void adjustmentValueChanged(AdjustmentEvent evt) {
                    populationSize = getValue();
                    populationLabel.setText(Integer.toString(getValue()));
                    populationLabel.repaint();
                }
            }
            );
        }
    }
    );
    panel.add(populationLabel);
}
 
開發者ID:Impro-Visor,項目名稱:Impro-Visor,代碼行數:23,代碼來源:ClimaticPopInitialiser.java

示例5: shouldFocusOnClick

import java.awt.Scrollbar; //導入依賴的package包/類
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? component.getPeer() : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick &&
           AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:27,代碼來源:KeyboardFocusManagerPeerImpl.java

示例6: SurfacePlotGroup

import java.awt.Scrollbar; //導入依賴的package包/類
/**
 * Constructs a surface plot for the given Content.
 * 
 * @param c
 */
public SurfacePlotGroup(final ContentInstant c) {
	super();
	this.c = c;
	final int res = c.getResamplingFactor();
	final ImagePlus imp =
		res == 1 ? c.getImage() : NaiveResampler.resample(c.getImage(), res, res,
			1);
	final Volume volume = new Volume(imp);
	volume.setChannels(c.getChannels());
	surfacep =
		new SurfacePlot(volume, c.getColor(), c.getTransparency(), c.getImage()
			.getSlice() - 1);

	surfacep.calculateMinMaxCenterPoint(min, max, center);
	addChild(surfacep);
	if (c.getImage().getStackSize() == 1) return;
	final StackWindow win = (StackWindow) c.getImage().getWindow();
	if (win == null) return;
	final Component[] co = win.getComponents();
	for (int i = 0; i < co.length; i++) {
		if (co[i] instanceof Scrollbar) {
			((Scrollbar) co[i]).addAdjustmentListener(this);
		}
	}
}
 
開發者ID:fiji,項目名稱:3D_Viewer,代碼行數:31,代碼來源:SurfacePlotGroup.java

示例7: Calque

import java.awt.Scrollbar; //導入依賴的package包/類
/** Creation de l'objet calque */
protected Calque(Aladin aladin) {
   this.aladin = aladin;

   select = new Select(aladin);
   zoom = new Zoom(aladin);
   scroll = new ScrollbarStack(aladin,Scrollbar.VERTICAL,FIRSTBLOC-1,1,0,FIRSTBLOC);

   // Creation des composantes de l'objet (plan, select et zoom)
   reallocPlan();
   flagOverlay = true;
   reticleMode=aladin.configuration.get(Configuration.RETICLE)!=null ? 2 : 1;
   flagTip=aladin.configuration.get(Configuration.TOOLTIP)!=null;
   flagAutoDist = aladin.configuration.getAutoDist();
   flagSimbad = aladin.configuration.getSimbadFlag();
   flagVizierSED = aladin.configuration.getVizierSEDFlag();
   
   setOverlayList("label,scale,size,NE,target,reticle,target,pixel");

   // Panel principal : contient le selecteur de plans et le zoom
   setLayout( new BorderLayout(0,5) );
   add(select,BorderLayout.CENTER);
   add(zoom,BorderLayout.SOUTH);
}
 
開發者ID:jankotek,項目名稱:asterope,代碼行數:25,代碼來源:Calque.java

示例8: Calque

import java.awt.Scrollbar; //導入依賴的package包/類
/** Creation de l'objet calque */
protected Calque(Aladin aladin) {
   this.aladin = aladin;

   select = new Select(aladin);
   zoom = new Zoom(aladin);
   scroll = new ScrollbarStack(aladin,Scrollbar.VERTICAL,FIRSTBLOC-1,1,0,FIRSTBLOC);

   // Creation des composantes de l'objet (plan, select et zoom)
   reallocPlan();
   flagOverlay = true;
   reticleMode=aladin.configuration.get(Configuration.RETICLE)!=null ? 2 : 1;
   flagTip=aladin.configuration.get(Configuration.TOOLTIP)!=null;
   flagAutoDist = aladin.configuration.getAutoDist();
   flagSimbad = aladin.configuration.getSimbadFlag();
   flagVizierSED = aladin.configuration.getVizierSEDFlag();
   
   setOverlayList("label,scale,size,NE,target,reticle,target,pixel,sofiaimagers");

   // Panel principal : contient le selecteur de plans et le zoom
   setLayout( new BorderLayout(0,5) );
   add(select,BorderLayout.CENTER);
   add(zoom,BorderLayout.SOUTH);
}
 
開發者ID:svvatters,項目名稱:SOFIAladin,代碼行數:25,代碼來源:Calque.java

示例9: createSliderPanel

import java.awt.Scrollbar; //導入依賴的package包/類
private void createSliderPanel(final Scrollbar sliderField, String label, final Label sliderLabel,
		final double scale)
{
	Label listLabel = new Label(label, 0);
	add(listLabel, 0, 1);
	sliderField.setSize(100, 10);
	c.ipadx = 75;
	add(sliderField, 1, 1);
	c.ipadx = 0;
	sliderField.addAdjustmentListener(new AdjustmentListener()
	{

		public void adjustmentValueChanged(AdjustmentEvent e)
		{
			setSliderLabel(sliderField, sliderLabel, scale);
		}
	});
	add(sliderLabel, 2, 1);
	setSliderLabel(sliderField, sliderLabel, scale);
	row++;
}
 
開發者ID:aherbert,項目名稱:GDSC,代碼行數:22,代碼來源:HSB_Picker.java

示例10: createPDs

import java.awt.Scrollbar; //導入依賴的package包/類
/** @return Propertydescriptors */
@Override
protected PropertyDescriptor[] createPDs() throws IntrospectionException {
    PropertyDescriptor[] pds = new PropertyDescriptor[] {
        new PropertyDescriptor("unitIncrement", Scrollbar.class), // NOI18N
        new PropertyDescriptor("minimum", Scrollbar.class), // NOI18N
        new PropertyDescriptor("maximum", Scrollbar.class), // NOI18N
        new PropertyDescriptor("value", Scrollbar.class), // NOI18N
        new PropertyDescriptor("blockIncrement", Scrollbar.class), // NOI18N
        new PropertyDescriptor("orientation", Scrollbar.class), // NOI18N
        new PropertyDescriptor("visibleAmount", Scrollbar.class), // NOI18N
    };
    pds[5].setPropertyEditorClass(ScrollbarBeanInfo.OrientationPropertyEditor.class);
    return pds;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ScrollbarBeanInfo.java

示例11: setAsText

import java.awt.Scrollbar; //導入依賴的package包/類
@Override
public void setAsText(String s) {
    Integer i;
    getTags();
    if (s.equals(tags[0])) i = new Integer(Scrollbar.HORIZONTAL);
    else i = new Integer(Scrollbar.VERTICAL);
    setValue(i);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:ScrollbarBeanInfo.java

示例12: shouldFocusOnClick

import java.awt.Scrollbar; //導入依賴的package包/類
@SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? component.getPeer() : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick &&
           AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:28,代碼來源:KeyboardFocusManagerPeerImpl.java

示例13: scrollToMinimum

import java.awt.Scrollbar; //導入依賴的package包/類
@Override
public void scrollToMinimum(ComponentOperator oper, final int orientation) {
    final Adjustable adj
            = (orientation == Scrollbar.HORIZONTAL)
                    ? ((ScrollPaneOperator) oper).getHAdjustable()
                    : ((ScrollPaneOperator) oper).getVAdjustable();
    scroll(oper,
            new ScrollAdjuster() {
        @Override
        public int getScrollDirection() {
            return ((adj.getMinimum() < adj.getValue())
                    ? DECREASE_SCROLL_DIRECTION
                    : DO_NOT_TOUCH_SCROLL_DIRECTION);
        }

        @Override
        public int getScrollOrientation() {
            return orientation;
        }

        @Override
        public String getDescription() {
            return "Scroll to minimum";
        }

        @Override
        public String toString() {
            return "scrollToMinimum.ScrollAdjuster{description = " + getDescription() + '}';
        }
    });
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:ScrollPaneDriver.java

示例14: scrollToMaximum

import java.awt.Scrollbar; //導入依賴的package包/類
@Override
public void scrollToMaximum(ComponentOperator oper, final int orientation) {
    final Adjustable adj
            = (orientation == Scrollbar.HORIZONTAL)
                    ? ((ScrollPaneOperator) oper).getHAdjustable()
                    : ((ScrollPaneOperator) oper).getVAdjustable();
    scroll(oper,
            new ScrollAdjuster() {
        @Override
        public int getScrollDirection() {
            return (((adj.getMaximum() - adj.getVisibleAmount()) > adj.getValue())
                    ? INCREASE_SCROLL_DIRECTION
                    : DO_NOT_TOUCH_SCROLL_DIRECTION);
        }

        @Override
        public int getScrollOrientation() {
            return orientation;
        }

        @Override
        public String getDescription() {
            return "Scroll to maximum";
        }

        @Override
        public String toString() {
            return "scrollToMaximum.ScrollAdjuster{description = " + getDescription() + '}';
        }
    });
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:ScrollPaneDriver.java

示例15: ScrollbarOperator

import java.awt.Scrollbar; //導入依賴的package包/類
/**
 * Constructs a ScrollbarOperator object.
 *
 * @param cont a container
 * @param index an index between appropriate ones.
 */
public ScrollbarOperator(ContainerOperator<?> cont, int index) {
    this((Scrollbar) waitComponent(cont,
            new ScrollbarFinder(),
            index));
    copyEnvironment(cont);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:ScrollbarOperator.java


注:本文中的java.awt.Scrollbar類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。