本文整理匯總了Java中java.awt.Adjustable類的典型用法代碼示例。如果您正苦於以下問題:Java Adjustable類的具體用法?Java Adjustable怎麽用?Java Adjustable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Adjustable類屬於java.awt包,在下文中一共展示了Adjustable類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: paintTrack
import java.awt.Adjustable; //導入依賴的package包/類
@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
import java.awt.Adjustable; //導入依賴的package包/類
@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: handleWheelScrolling
import java.awt.Adjustable; //導入依賴的package包/類
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
}
int increment = 0;
if (sp != null && e.getScrollAmount() != 0) {
Adjustable adj = getAdjustableToScroll(sp);
if (adj != null) {
increment = getIncrementFromAdjustable(adj, e);
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
}
scrollAdjustable(adj, increment);
}
}
}
示例4: getIncrementFromAdjustable
import java.awt.Adjustable; //導入依賴的package包/類
public static int getIncrementFromAdjustable(Adjustable adj,
MouseWheelEvent e) {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
if (adj == null) {
log.fine("Assertion (adj != null) failed");
}
}
int increment = 0;
if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
increment = e.getUnitsToScroll() * adj.getUnitIncrement();
}
else if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
increment = adj.getBlockIncrement() * e.getWheelRotation();
}
return increment;
}
示例5: initializeImpl
import java.awt.Adjustable; //導入依賴的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);
}
}
示例6: PreferenceByteGlobalJScrollBar
import java.awt.Adjustable; //導入依賴的package包/類
/**
* 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);
}
示例7: scrollToTop
import java.awt.Adjustable; //導入依賴的package包/類
/**
* Scrolls pane to top.
*
* @throws TimeoutExpiredException
*/
public void scrollToTop() {
output.printTrace("Scroll ScrollPane to top\n"
+ toStringSource());
output.printGolden("Scroll ScrollPane to top");
produceTimeRestricted(new Action<Void, Void>() {
@Override
public Void launch(Void obj) {
driver.scrollToMinimum(ScrollPaneOperator.this, Adjustable.VERTICAL);
return null;
}
@Override
public String getDescription() {
return "Scrolling";
}
@Override
public String toString() {
return "ScrollPaneOperator.scrollToTop.Action{description = " + getDescription() + '}';
}
}, "ScrollbarOperator.WholeScrollTimeout");
}
示例8: scrollToBottom
import java.awt.Adjustable; //導入依賴的package包/類
/**
* Scrolls pane to bottom.
*
* @throws TimeoutExpiredException
*/
public void scrollToBottom() {
output.printTrace("Scroll ScrollPane to bottom\n"
+ toStringSource());
output.printGolden("Scroll ScrollPane to bottom");
produceTimeRestricted(new Action<Void, Void>() {
@Override
public Void launch(Void obj) {
driver.scrollToMaximum(ScrollPaneOperator.this, Adjustable.VERTICAL);
return null;
}
@Override
public String getDescription() {
return "Scrolling";
}
@Override
public String toString() {
return "ScrollPaneOperator.scrollToBottom.Action{description = " + getDescription() + '}';
}
}, "ScrollbarOperator.WholeScrollTimeout");
}
示例9: scrollToLeft
import java.awt.Adjustable; //導入依賴的package包/類
/**
* Scrolls pane to left.
*
* @throws TimeoutExpiredException
*/
public void scrollToLeft() {
output.printTrace("Scroll ScrollPane to left\n"
+ toStringSource());
output.printGolden("Scroll ScrollPane to left");
produceTimeRestricted(new Action<Void, Void>() {
@Override
public Void launch(Void obj) {
driver.scrollToMinimum(ScrollPaneOperator.this, Adjustable.HORIZONTAL);
return null;
}
@Override
public String getDescription() {
return "Scrolling";
}
@Override
public String toString() {
return "ScrollPaneOperator.scrollToLeft.Action{description = " + getDescription() + '}';
}
}, "ScrollbarOperator.WholeScrollTimeout");
}
示例10: scrollToRight
import java.awt.Adjustable; //導入依賴的package包/類
/**
* Scrolls pane to right.
*
* @throws TimeoutExpiredException
*/
public void scrollToRight() {
output.printTrace("Scroll ScrollPane to right\n"
+ toStringSource());
output.printGolden("Scroll ScrollPane to right");
produceTimeRestricted(new Action<Void, Void>() {
@Override
public Void launch(Void obj) {
driver.scrollToMaximum(ScrollPaneOperator.this, Adjustable.HORIZONTAL);
return null;
}
@Override
public String getDescription() {
return "Scrolling";
}
@Override
public String toString() {
return "ScrollPaneOperator.scrollToRight.Action{description = " + getDescription() + '}';
}
}, "ScrollbarOperator.WholeScrollTimeout");
}
示例11: getScrollDirection
import java.awt.Adjustable; //導入依賴的package包/類
@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;
}
}
示例12: getHorizontalScrollBar
import java.awt.Adjustable; //導入依賴的package包/類
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;
}
示例13: getVerticalScrollBar
import java.awt.Adjustable; //導入依賴的package包/類
public final JScrollBar getVerticalScrollBar(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.VERTICAL) {
return jsb;
}
}
}
int max = getVerticalScrollMax(cp);
if(max>1) {
JScrollBar vBar = new JScrollBar(Adjustable.VERTICAL, 0, 0, 0, max);
vBar.addAdjustmentListener(scrollBarListener);
cp.add(vBar);
vBar.putClientProperty("JComponent.sizeVariant", "mini");
vBar.setCursor(Cursor.getDefaultCursor());
updateScrollBarBounds(cp);
return vBar;
}
return null;
}
示例14: scroll
import java.awt.Adjustable; //導入依賴的package包/類
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));
}