本文整理了Java中javax.swing.JSlider.getOrientation()
方法的一些代码示例,展示了JSlider.getOrientation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.getOrientation()
方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:getOrientation
暂无
代码示例来源:origin: stackoverflow.com
JSlider slider = new JSlider(JSlider.HORIZONTAL);
slider.setUI(new MetalSliderUI() {
protected void scrollDueToClickInTrack(int direction) {
// this is the default behaviour, let's comment that out
//scrollByBlock(direction);
int value = slider.getValue();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
value = this.valueForXPosition(slider.getMousePosition().x);
} else if (slider.getOrientation() == JSlider.VERTICAL) {
value = this.valueForYPosition(slider.getMousePosition().y);
}
slider.setValue(value);
}
});
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/** Gets the height of the tick area for horizontal sliders and the width of
* the tick area for vertical sliders. BasicSliderUI uses the returned value
* to determine the tick area rectangle.
*/
public int getTickLength()
{
return slider.getOrientation()==JSlider.HORIZONTAL
? tickLength+TICK_BUFFER+1 : tickLength+TICK_BUFFER+3;
}
代码示例来源:origin: net.java.dev.designgridlayout/designgridlayout
@Override protected boolean componentCanGrowHeight(JSlider component)
{
return component.getOrientation() == JSlider.VERTICAL;
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected int getTrackWidth() {
if (slider.getOrientation() == JSlider.HORIZONTAL) {
return (thumbRect.height - 9);
} else {
return (thumbRect.width - 9);
}
}
代码示例来源:origin: net.sf.tinylaf/tinylaf
protected Dimension getThumbSize() {
if(slider.getOrientation() == JSlider.VERTICAL) {
return sliderVertSize;
}
else {
return sliderHorzSize;
}
}
代码示例来源:origin: khuxtable/seaglass
protected Dimension getThumbSize() {
Dimension size = new Dimension();
if (slider.getOrientation() == JSlider.VERTICAL) {
size.width = thumbHeight;
size.height = thumbWidth;
} else {
size.width = thumbWidth;
size.height = thumbHeight;
}
return size;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected Dimension getThumbSize() {
Dimension size = new Dimension();
if (slider.getOrientation() == JSlider.VERTICAL) {
size.width = 20;
size.height = 11;
} else {
size.width = IMAGE_ZOOM_BAR_NORM.getWidth(null);
size.height = IMAGE_ZOOM_BAR_NORM.getHeight(null);
}
return size;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/napkinlaf
private NapkinSliderUI(JSlider c) {
super(c);
vertical = (c.getOrientation() == VERTICAL);
trackBounds = new Rectangle();
tickBounds = new Rectangle();
major = new ArrayList<DrawnLineHolder>(0);
minor = new ArrayList<DrawnLineHolder>(0);
}
代码示例来源:origin: org.java.net.substance/substance
@Override
protected void calculateThumbLocation() {
super.calculateThumbLocation();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
thumbRect.y -= 1;
} else {
thumbRect.x -= 1;
}
}
代码示例来源:origin: com.synaptix/SynaptixSwing
public Dimension getMaximumSize(JComponent c) {
Dimension d = getPreferredSize(c);
if (slider.getOrientation() == JSlider.VERTICAL) {
d.height = Short.MAX_VALUE;
} else {
d.width = Short.MAX_VALUE;
}
return d;
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
@Override
protected void calculateThumbLocation() {
super.calculateThumbLocation();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
thumbRect.y -= 3;
} else {
thumbRect.x -= 3;
}
}
/*
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf
public Dimension getThumbSize(JSlider slider) {
if (h_thumb != null) {
if (slider.getOrientation() == HORIZONTAL) {
return h_thumb.getPreferredSize();
} else {
return v_thumb.getPreferredSize();
}
}
else {
return null;
}
}
代码示例来源:origin: org.java.net.substance/substance
@Override
protected void calculateTrackRect() {
super.calculateTrackRect();
if (this.slider.getOrientation() == SwingConstants.HORIZONTAL) {
this.trackRect.y = 3
+ (int) Math.ceil(SubstanceSizeUtils
.getFocusStrokeWidth(SubstanceSizeUtils
.getComponentFontSize(this.slider)))
+ this.insetCache.top;
}
}
代码示例来源:origin: net.sf.tinylaf/tinylaf
protected int getThumbOverhang() {
if(slider.getOrientation() == JSlider.VERTICAL) {
return (int) (getThumbSize().getWidth() - getTrackWidth()) / 2;
}
else {
return (int) (getThumbSize().getHeight() - getTrackWidth()) / 2;
}
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
protected void calculateLabelRect() {
super.calculateLabelRect();
if ((this.slider.getOrientation() == JSlider.VERTICAL)
&& !this.slider.getPaintTicks()
&& this.slider.getComponentOrientation().isLeftToRight()) {
this.labelRect.x += 3;
}
}
代码示例来源:origin: com.jidesoft/jide-oss
protected Point adjustThumbForHighValue() {
Point p = thumbRect.getLocation();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
int valuePosition = xPositionForValue(((RangeSlider) slider).getHighValue());
thumbRect.x = valuePosition - (thumbRect.width / 2);
}
else {
int valuePosition = yPositionForValue(((RangeSlider) slider).getHighValue());
thumbRect.y = valuePosition - (thumbRect.height / 2);
}
return p;
}
代码示例来源:origin: com.jidesoft/jide-oss
protected Point adjustThumbForHighValue() {
Point p = thumbRect.getLocation();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
int valuePosition = xPositionForValue(((RangeSlider) slider).getHighValue());
thumbRect.x = valuePosition - (thumbRect.width / 2);
}
else {
int valuePosition = yPositionForValue(((RangeSlider) slider).getHighValue());
thumbRect.y = valuePosition - (thumbRect.height / 2);
}
return p;
}
代码示例来源:origin: com.jidesoft/jide-oss
protected Point adjustThumbForHighValue() {
Point p = thumbRect.getLocation();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
int valuePosition = xPositionForValue(((RangeSlider) slider).getHighValue());
thumbRect.x = valuePosition - (thumbRect.width / 2);
}
else {
int valuePosition = yPositionForValue(((RangeSlider) slider).getHighValue());
thumbRect.y = valuePosition - (thumbRect.height / 2);
}
return p;
}
代码示例来源:origin: com.jidesoft/jide-oss
protected Point adjustThumbForHighValue() {
Point p = thumbRect.getLocation();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
int valuePosition = xPositionForValue(((RangeSlider) slider).getHighValue());
thumbRect.x = valuePosition - (thumbRect.width / 2);
}
else {
int valuePosition = yPositionForValue(((RangeSlider) slider).getHighValue());
thumbRect.y = valuePosition - (thumbRect.height / 2);
}
return p;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected boolean drawInverted() {
if (slider.getOrientation() == JSlider.HORIZONTAL) {
if (slider.getComponentOrientation().isLeftToRight()) {
return slider.getInverted();
} else {
return !slider.getInverted();
}
} else {
return slider.getInverted();
}
}
内容来源于网络,如有侵权,请联系作者删除!