本文整理汇总了Java中javax.swing.JScrollBar.HORIZONTAL属性的典型用法代码示例。如果您正苦于以下问题:Java JScrollBar.HORIZONTAL属性的具体用法?Java JScrollBar.HORIZONTAL怎么用?Java JScrollBar.HORIZONTAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.JScrollBar
的用法示例。
在下文中一共展示了JScrollBar.HORIZONTAL属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
public void run() {
if (this.bar == null) {
this.bar = new JScrollBar(JScrollBar.HORIZONTAL, 50, 10, 0, 100);
this.bar.setPreferredSize(new Dimension(400, 20));
JFrame frame = new JFrame();
frame.add(this.bar);
frame.pack();
frame.setVisible(true);
}
else if (40 != this.bar.getValue()) {
System.out.println("name = " + UIManager.getLookAndFeel().getName());
System.out.println("value = " + this.bar.getValue());
}
else {
SwingUtilities.getWindowAncestor(this.bar).dispose();
this.bar = null;
}
}
示例2: getScrollDirection
@Override
public int getScrollDirection(JScrollBarOperator oper) {
Point toPoint = SwingUtilities.
convertPoint(comp, x, y, getViewport().getView());
int to = (orientation == JScrollBar.HORIZONTAL) ? toPoint.x : toPoint.y;
int ln = (orientation == JScrollBar.HORIZONTAL) ? width : height;
int lv = (orientation == JScrollBar.HORIZONTAL) ? getViewport().getWidth() : getViewport().getHeight();
int vl = oper.getValue();
if (to < vl) {
return ScrollAdjuster.DECREASE_SCROLL_DIRECTION;
} else if ((to + ln - 1) > (vl + lv)
&& to > vl) {
return ScrollAdjuster.INCREASE_SCROLL_DIRECTION;
} else {
return ScrollAdjuster.DO_NOT_TOUCH_SCROLL_DIRECTION;
}
}
示例3: createFakeHSB
private JScrollBar createFakeHSB(final JScrollBar hsb) {
return new JScrollBar(JScrollBar.HORIZONTAL) {
@Override
public Dimension getPreferredSize() {
Dimension dim = hsb.getPreferredSize();
return new Dimension(dim.width, 2*dim.height);
}
};
}
示例4: getClickPoint
private Point getClickPoint(JScrollBarOperator oper, JButtonOperator lessButton, JButtonOperator moreButton, int value) {
int lenght = (oper.getOrientation() == JScrollBar.HORIZONTAL)
? oper.getWidth() - lessButton.getWidth() - moreButton.getWidth()
: oper.getHeight() - lessButton.getHeight() - moreButton.getHeight();
int subpos = (int) (((float) lenght / (oper.getMaximum() - oper.getMinimum())) * value);
if (oper.getOrientation() == JScrollBar.HORIZONTAL) {
subpos = subpos + lessButton.getWidth();
} else {
subpos = subpos + lessButton.getHeight();
}
subpos = subpos + MINIMAL_DRAGGER_SIZE / 2 + 1;
return ((oper.getOrientation() == JScrollBar.HORIZONTAL)
? new Point(subpos, oper.getHeight() / 2)
: new Point(oper.getWidth() / 2, subpos));
}
示例5: installUI
@Override
public void installUI(JComponent c) {
super.installUI(c);
if ((scrollbar.getOrientation() == JScrollBar.HORIZONTAL)) {
c.setPreferredSize(new Dimension(15, c.getPreferredSize().height));
} else {
c.setPreferredSize(new Dimension(c.getPreferredSize().width, 15));
}
// c.setMaximumSize(new Dimension(10, Integer.MAX_VALUE));
}
示例6: createHorizontalScrollBar
@Override
public JScrollBar createHorizontalScrollBar() {
return new XAWTScrollBar(JScrollBar.HORIZONTAL);
}
示例7: initOperators
private void initOperators() {
if (minButtOperator != null
&& maxButtOperator != null) {
return;
}
ComponentChooser chooser = new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return comp instanceof JButton;
}
@Override
public String getDescription() {
return "";
}
@Override
public String toString() {
return "JScrollBarOperator.initOperators.ComponentChooser{description = " + getDescription() + '}';
}
};
ComponentSearcher searcher = new ComponentSearcher((Container) getSource());
searcher.setOutput(output.createErrorOutput());
JButton butt0 = (JButton) searcher.findComponent(chooser, 0);
JButton butt1 = (JButton) searcher.findComponent(chooser, 1);
if (butt0 == null || butt1 == null) {
minButtOperator = null;
maxButtOperator = null;
return;
}
JButton minButt, maxButt;
if (((JScrollBar) getSource()).getOrientation() == JScrollBar.HORIZONTAL) {
if (butt0.getX() < butt1.getX()) {
minButt = butt0;
maxButt = butt1;
} else {
minButt = butt1;
maxButt = butt0;
}
} else if (butt0.getY() < butt1.getY()) {
minButt = butt0;
maxButt = butt1;
} else {
minButt = butt1;
maxButt = butt0;
}
minButtOperator = new JButtonOperator(minButt);
maxButtOperator = new JButtonOperator(maxButt);
minButtOperator.copyEnvironment(this);
maxButtOperator.copyEnvironment(this);
minButtOperator.setOutput(output.createErrorOutput());
maxButtOperator.setOutput(output.createErrorOutput());
Timeouts times = timeouts.cloneThis();
times.setTimeout("AbstractButtonOperator.PushButtonTimeout",
times.getTimeout("JScrollBarOperator.OneScrollClickTimeout"));
minButtOperator.setTimeouts(times);
maxButtOperator.setTimeouts(times);
minButtOperator.setVisualizer(new EmptyVisualizer());
maxButtOperator.setVisualizer(new EmptyVisualizer());
}