本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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++;
}
示例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;
}
示例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);
}
示例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);
}
示例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() + '}';
}
});
}
示例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() + '}';
}
});
}
示例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);
}