本文整理匯總了Java中java.awt.Adjustable.HORIZONTAL屬性的典型用法代碼示例。如果您正苦於以下問題:Java Adjustable.HORIZONTAL屬性的具體用法?Java Adjustable.HORIZONTAL怎麽用?Java Adjustable.HORIZONTAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.Adjustable
的用法示例。
在下文中一共展示了Adjustable.HORIZONTAL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: paintTrack
@Override
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
int x = (int) trackBounds.getX();
int y = (int) trackBounds.getY();
int w = (int) trackBounds.getWidth();
int h = (int) trackBounds.getHeight();
g.setColor(Colors.SCROLLBAR_TRACK_BACKGROUND);
g.fillRect(x - 1, y - 1, w + 2, h + 2);
g.setColor(Colors.SCROLLBAR_TRACK_BORDER);
if (this.scrollbar.getOrientation() == Adjustable.HORIZONTAL) {
g.drawLine(x, y, x + w, y);
} else {
g.drawLine(x, y, x, y + h);
}
}
示例2: paintThumb
@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
int x = (int) thumbBounds.getX();
int y = (int) thumbBounds.getY();
int w = (int) thumbBounds.getWidth();
int h = (int) thumbBounds.getHeight();
if (c.isEnabled() && w > 0 && h > 0) {
if (this.scrollbar.getOrientation() == Adjustable.HORIZONTAL) {
h -= 1;
y++;
drawHorizThumb(g, x, y, w, h);
} else {
w -= 1;
x++;
drawVertThumb(g, x, y, w, h);
}
}
}
示例3: PreferenceByteGlobalJScrollBar
/**
* Constructs
*
* @param objPpreferencesJDialog
* @param bytPpreferenceType
*/
public PreferenceByteGlobalJScrollBar(PreferencesJDialog objPpreferencesJDialog, byte bytPpreferenceType) {
super(Adjustable.HORIZONTAL);
this.objGpreferencesJDialog = objPpreferencesJDialog;
this.bytGpreferenceType = bytPpreferenceType;
this.setOpaque(true);
switch (this.bytGpreferenceType) {
case Constants.bytS_BYTE_GLOBAL_GAMMA_CORRECTION:
this.setValues( this.objGpreferencesJDialog.bytGbyteGlobalAA[this.bytGpreferenceType][Constants.bytS_UNCLASS_INITIAL],
1,
Constants.bytS_BYTE_GLOBAL_GAMMA_CORRECTION_MINIMUM_VALUE,
Constants.bytS_BYTE_GLOBAL_GAMMA_CORRECTION_MAXIMUM_VALUE + 1);
this.setBlockIncrement(3);
break;
}
this.addAdjustmentListener(this);
}
示例4: getScrollDirection
@Override
public int getScrollDirection() {
int sp = (orientation == Adjustable.HORIZONTAL)
? (int) getScrollPosition().getX()
: (int) getScrollPosition().getY();
Point pnt = SwingUtilities.convertPoint(comp, x, y, ((Container) getSource()).getComponents()[0]);
int cp = (orientation == Adjustable.HORIZONTAL)
? pnt.x
: pnt.y;
int sl = (orientation == Adjustable.HORIZONTAL)
? (int) getViewportSize().getWidth()
: (int) getViewportSize().getHeight();
int cl = (orientation == Adjustable.HORIZONTAL)
? width
: height;
if (cp <= sp) {
return ScrollAdjuster.DECREASE_SCROLL_DIRECTION;
} else if ((cp + cl) > (sp + sl)
&& cp > sp) {
return ScrollAdjuster.INCREASE_SCROLL_DIRECTION;
} else {
return ScrollAdjuster.DO_NOT_TOUCH_SCROLL_DIRECTION;
}
}
示例5: getHorizontalScrollBar
public final JScrollBar getHorizontalScrollBar(ColorPalette cp) {
for(int index = 0; index<cp.getComponentCount(); index++) {
Component comp = cp.getComponent(index);
if(comp instanceof JScrollBar) {
JScrollBar jsb = (JScrollBar)comp;
if(jsb.getOrientation()==Adjustable.HORIZONTAL) {
return jsb;
}
}
}
int max = getHorizontalScrollMax(cp);
if(max>1) {
JScrollBar hBar = new JScrollBar(Adjustable.HORIZONTAL, 0, 0, 0, max);
hBar.addAdjustmentListener(scrollBarListener);
cp.add(hBar);
hBar.putClientProperty("JComponent.sizeVariant", "mini");
hBar.setCursor(Cursor.getDefaultCursor());
updateScrollBarBounds(cp);
return hBar;
}
return null;
}
示例6: scroll
public void scroll(final int movement) {
ScrollbarLocationManipulation locationManipulation = new ScrollbarLocationManipulation();
perform("locating scroll bar", locationManipulation);
moveMouseToOffset(locationManipulation.getX(), locationManipulation.getY());
performGesture(new MousePressGesture(InputEvent.BUTTON1_MASK));
if (locationManipulation.getOrientation() == Adjustable.HORIZONTAL) {
performGesture(new MouseMoveAbsoluteGesture(Adjustable.HORIZONTAL, movement));
} else {
performGesture(new MouseMoveAbsoluteGesture(Adjustable.HORIZONTAL, movement));
}
performGesture(new MouseReleaseGesture(InputEvent.BUTTON1_MASK));
}
示例7: scrollBy
/**
* Scroll by.
*
* @param orientation
* the orientation
* @param offset
* the offset
*/
public void scrollBy(int orientation, int offset) {
RBlockViewport bodyLayout = this.bodyLayout;
if (bodyLayout != null) {
switch (orientation) {
case Adjustable.HORIZONTAL:
this.scrollHorizontalTo(bodyLayout.x - offset);
break;
case Adjustable.VERTICAL:
this.scrollVerticalTo(bodyLayout.y - offset);
break;
default:
break;
}
}
}
示例8: scrollToSBValue
/**
* Scroll to sb value.
*
* @param orientation
* the orientation
* @param value
* the value
*/
private void scrollToSBValue(int orientation, int value) {
Insets insets = this.getInsets(this.hasHScrollBar, this.hasVScrollBar);
switch (orientation) {
case Adjustable.HORIZONTAL:
int xOrigin = insets.left - value;
this.scrollHorizontalTo(xOrigin);
break;
case Adjustable.VERTICAL:
int yOrigin = insets.top - value;
this.scrollVerticalTo(yOrigin);
break;
default:
break;
}
}
示例9: SliderPanel
public SliderPanel(final ImgData<?> imgData) {
setBorder(new TitledBorder(imgData.name));
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
// add one slider per dimension beyond the first two
for (int d = 2; d < imgData.imgPlus.numDimensions(); d++) {
final int dimLength = (int) imgData.imgPlus.dimension(d);
final JScrollBar bar =
new JScrollBar(Adjustable.HORIZONTAL, 0, 1, 0, dimLength);
final int dim = d;
bar.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(final AdjustmentEvent e) {
final int value = bar.getValue();
imgData.projector.setPosition(value, dim);
imgData.projector.map();
imgData.owner.repaint();
}
});
add(bar);
}
}
示例10: isAdjNeeded
/**
* Determines whether a specified adjustable should
* be displayed using scrollbar display policy
* @param adj scrollbar
* @return true if scrollbar should be displayed, false otherwise
*/
private boolean isAdjNeeded(Adjustable adj) {
if (adj == null) {
return false;
}
switch (scrollable.getAdjustableMode(adj)) {
case Scrollable.ALWAYS:
return true;
case Scrollable.NEVER:
return false;
case Scrollable.AS_NEEDED:
return calculateNeeded(adj);
case Scrollable.HORIZONTAL_ONLY:
return adj.getOrientation() == Adjustable.HORIZONTAL;
case Scrollable.VERTICAL_ONLY:
return adj.getOrientation() == Adjustable.VERTICAL;
}
return true;
}
示例11: paintThumb
@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
int x = (int)thumbBounds.getX();
int y = (int)thumbBounds.getY();
int w = (int)thumbBounds.getWidth();
int h = (int)thumbBounds.getHeight();
if (c.isEnabled() && (w > 0) && (h > 0)) {
if (this.scrollbar.getOrientation() == Adjustable.HORIZONTAL) {
h -= 2;
y++;
drawHorizThumb(g, x, y, w, h);
} else {
w -= 2;
x++;
drawVertThumb(g, x, y, w, h);
}
}
}
示例12: createDecreaseButton
@Override
protected JButton createDecreaseButton(int orientation) {
if (this.scrollbar.getOrientation() == Adjustable.HORIZONTAL) {
this.decreaseButton = new GenericArrowButton(orientation, this.scrollbar.getHeight(), SCROLLBAR_WIDTH - 1);
} else {
this.decreaseButton = new GenericArrowButton(orientation, SCROLLBAR_WIDTH - 1, this.scrollbar.getWidth());
}
return this.decreaseButton;
}
示例13: createIncreaseButton
@Override
protected JButton createIncreaseButton(int orientation) {
if (this.scrollbar.getOrientation() == Adjustable.HORIZONTAL) {
this.increaseButton = new GenericArrowButton(orientation, this.scrollbar.getHeight(), SCROLLBAR_WIDTH - 1);
} else {
this.increaseButton = new GenericArrowButton(orientation, SCROLLBAR_WIDTH - 1, this.scrollbar.getWidth());
}
return this.increaseButton;
}
示例14: PreferenceByteLocalJScrollBar
/**
* Constructs
*
* @param objPpreferencesJDialog
* @param bytPpreferenceType
*/
public PreferenceByteLocalJScrollBar(PreferencesJDialog objPpreferencesJDialog, byte bytPpreferenceType) {
super(Adjustable.HORIZONTAL);
this.objGpreferencesJDialog = objPpreferencesJDialog;
this.bytGpreferenceType = bytPpreferenceType;
this.setOpaque(true);
switch (this.bytGpreferenceType) {
case PreferencesJDialog.bytS_BYTE_LOCAL_PREFERENCE_SPEED:
this.setValues( this.objGpreferencesJDialog.bytGbyteLocalAA[this.bytGpreferenceType][Constants.bytS_UNCLASS_INITIAL],
1,
Constants.bytS_BYTE_LOCAL_SPEED_MINIMUM_VALUE,
Constants.bytS_BYTE_LOCAL_SPEED_MAXIMUM_VALUE + 1);
this.setBlockIncrement(5);
break;
case PreferencesJDialog.bytS_BYTE_LOCAL_PREFERENCE_BALLS:
this.setValues( this.objGpreferencesJDialog.bytGbyteLocalAA[this.bytGpreferenceType][Constants.bytS_UNCLASS_INITIAL],
1,
Constants.bytS_BYTE_LOCAL_BALLS_MINIMUM_VALUE,
Constants.bytS_BYTE_LOCAL_BALLS_MAXIMUM_VALUE + 1);
this.setBlockIncrement(5);
break;
case PreferencesJDialog.bytS_BYTE_LOCAL_PREFERENCE_FLUIDITY:
this.setValues( this.objGpreferencesJDialog.bytGbyteLocalAA[this.bytGpreferenceType][Constants.bytS_UNCLASS_INITIAL],
1,
Constants.bytS_BYTE_LOCAL_FLUIDITY_MINIMUM_VALUE,
Constants.bytS_BYTE_LOCAL_FLUIDITY_MAXIMUM_VALUE + 1);
this.setBlockIncrement(10);
//$FALL-THROUGH$
default:
break;
}
this.addAdjustmentListener(this);
}
示例15: ExtendedJScrollBar
public ExtendedJScrollBar(ControlJFrame objPcontrolJFrame, int intP1, int intP2, int intP3, int intP4, int intPblockIncrement, int intPtooltip) {
super(Adjustable.HORIZONTAL, intP1, intP2, intP3, intP4);
this.objGcontrolJFrame = objPcontrolJFrame;
this.intGtooltip = intPtooltip;
this.setBlockIncrement(intPblockIncrement);
this.setOpaque(true);
this.setFocusable(false);
this.addAdjustmentListener(this);
}