本文整理了Java中javax.swing.JSlider.getUI()
方法的一些代码示例,展示了JSlider.getUI()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.getUI()
方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:getUI
暂无
代码示例来源:origin: com.synaptix/SynaptixSwing
public void actionPerformed(ActionEvent evt) {
JSlider slider = (JSlider) evt.getSource();
ZoomSliderUI ui = ZoomSliderUI.class.isInstance(slider.getUI()) ? (ZoomSliderUI) slider
.getUI()
: null;
if (ui == null) {
return;
}
SHARED_ACTION.scroll(slider, ui, dir, block);
}
}
代码示例来源:origin: com.synaptix/SynaptixSwing
public void actionPerformed(ActionEvent evt) {
JSlider slider = (JSlider) evt.getSource();
DayWidthSliderUI ui = DayWidthSliderUI.class.isInstance(slider
.getUI()) ? (DayWidthSliderUI) slider.getUI() : null;
if (ui == null) {
return;
}
SHARED_ACTION.scroll(slider, ui, dir, block);
}
}
代码示例来源:origin: org.java.net.substance/substance
public boolean isInside(MouseEvent me) {
try {
Rectangle thumbB = (Rectangle) this.thumbRectField
.get(this.slider.getUI());
if (thumbB == null)
return false;
return thumbB.contains(me.getX(), me.getY());
} catch (Exception exc) {
return false;
}
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
public boolean isInside(MouseEvent me) {
try {
Rectangle thumbB = (Rectangle) this.thumbRectField
.get(this.slider.getUI());
if (thumbB == null)
return false;
return thumbB.contains(me.getX(), me.getY());
} catch (Exception exc) {
return false;
}
}
代码示例来源:origin: tulskiy/musique
private int getSliderValueForX(JSlider slider, int x) {
return ((BasicSliderUI) slider.getUI()).valueForXPosition(x);
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets
int getSliderValue(MouseEvent e) {
JSlider slider = (JSlider) e.getSource();
int value = -1;
if (slider.getUI() instanceof BasicSliderUI) {
BasicSliderUI ui = (BasicSliderUI) slider.getUI();
value = slider.getOrientation() == JSlider.HORIZONTAL
? ui.valueForXPosition(e.getX())
: ui.valueForYPosition(e.getY());
}
return value;
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-widget
int getSliderValue(MouseEvent e) {
JSlider slider = (JSlider) e.getSource();
int value = -1;
if (slider.getUI() instanceof BasicSliderUI) {
BasicSliderUI ui = (BasicSliderUI) slider.getUI();
value = slider.getOrientation() == JSlider.HORIZONTAL
? ui.valueForXPosition(e.getX())
: ui.valueForYPosition(e.getY());
}
return value;
}
代码示例来源:origin: org.java.net.substance/substance
public void paintIcon(Component c, Graphics g, int x, int y) {
if (!(g instanceof Graphics2D)) {
return;
}
JSlider slider = (JSlider) c;
TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider
.getUI();
StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
Icon iconToDraw = getIcon(slider, stateTransitionTracker);
iconToDraw.paintIcon(c, g, x, y);
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (!(g instanceof Graphics2D)) {
return;
}
JSlider slider = (JSlider) c;
TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider
.getUI();
StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
Icon iconToDraw = getIcon(slider, stateTransitionTracker);
iconToDraw.paintIcon(c, g, x, y);
}
代码示例来源:origin: org.java.net.substance/substance
/**
* Simple constructor.
*
* @param slider
* The associated slider.
*/
public TrackableSlider(JSlider slider, ButtonModel transitionModel) {
this.slider = slider;
this.transitionModel = transitionModel;
SliderUI sliderUI = slider.getUI();
if (sliderUI instanceof BasicSliderUI) {
try {
this.thumbRectField = BasicSliderUI.class
.getDeclaredField("thumbRect");
this.thumbRectField.setAccessible(true);
} catch (Exception exc) {
this.thumbRectField = null;
}
}
this.stateTransitionTracker = new StateTransitionTracker(
this.slider, this.transitionModel);
}
代码示例来源:origin: org.java.net.substance/substance
public void paintIcon(Component c, Graphics g, int x, int y) {
if (!(g instanceof Graphics2D)) {
return;
}
JSlider slider = (JSlider) c;
TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider
.getUI();
StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
Icon iconToDraw = getIcon(slider, stateTransitionTracker);
iconToDraw.paintIcon(c, g, x, y);
}
代码示例来源:origin: com.github.insubstantial/substance
/**
* Simple constructor.
*
* @param slider
* The associated slider.
*/
public TrackableSlider(JSlider slider, ButtonModel transitionModel) {
this.slider = slider;
this.transitionModel = transitionModel;
SliderUI sliderUI = slider.getUI();
if (sliderUI instanceof BasicSliderUI) {
try {
this.thumbRectField = BasicSliderUI.class
.getDeclaredField("thumbRect");
this.thumbRectField.setAccessible(true);
} catch (Exception exc) {
this.thumbRectField = null;
}
}
this.stateTransitionTracker = new StateTransitionTracker(
this.slider, this.transitionModel);
}
代码示例来源:origin: org.java.net.substance/substance
public void paintIcon(Component c, Graphics g, int x, int y) {
if (!(g instanceof Graphics2D)) {
return;
}
JSlider slider = (JSlider) c;
TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider
.getUI();
StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
Icon iconToDraw = getIcon(slider, stateTransitionTracker);
iconToDraw.paintIcon(c, g, x, y);
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (!(g instanceof Graphics2D)) {
return;
}
JSlider slider = (JSlider) c;
TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider
.getUI();
StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
Icon iconToDraw = getIcon(slider, stateTransitionTracker);
iconToDraw.paintIcon(c, g, x, y);
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (!(g instanceof Graphics2D)) {
return;
}
JSlider slider = (JSlider) c;
TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider
.getUI();
StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
Icon iconToDraw = getIcon(slider, stateTransitionTracker);
iconToDraw.paintIcon(c, g, x, y);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
public void actionPerformed(ActionEvent evt) {
JSlider slider = (JSlider) evt.getSource();
DayWidthSliderUI ui = DayWidthSliderUI.class.isInstance(slider
.getUI()) ? (DayWidthSliderUI) slider.getUI() : null;
String name = getName();
if (ui == null) {
return;
}
if (POSITIVE_UNIT_INCREMENT == name) {
scroll(slider, ui, POSITIVE_SCROLL, false);
} else if (NEGATIVE_UNIT_INCREMENT == name) {
scroll(slider, ui, NEGATIVE_SCROLL, false);
} else if (POSITIVE_BLOCK_INCREMENT == name) {
scroll(slider, ui, POSITIVE_SCROLL, true);
} else if (NEGATIVE_BLOCK_INCREMENT == name) {
scroll(slider, ui, NEGATIVE_SCROLL, true);
} else if (MIN_SCROLL_INCREMENT == name) {
scroll(slider, ui, MIN_SCROLL, false);
} else if (MAX_SCROLL_INCREMENT == name) {
scroll(slider, ui, MAX_SCROLL, false);
}
}
代码示例来源:origin: org.java.net.substance/substance
/**
* Configures a JSlider for this ColorSliderModel.
* If the JSlider is already configured for another ColorSliderModel,
* it is unconfigured first.
*/
public void configureColorSlider(int component, JSlider slider) {
if (slider.getClientProperty("ColorSliderModel") != null) {
((ColorSliderModel) slider.getClientProperty("ColorSliderModel"))
.unconfigureColorSlider(slider);
}
if ( ! (slider.getUI() instanceof ColorSliderUI)) {
slider.setUI(new ColorSliderUI(slider));
}
slider.setModel(getBoundedRangeModel(component));
slider.putClientProperty("ColorSliderModel", this);
slider.putClientProperty("ColorComponentIndex", new Integer(component));
addColorSlider(slider);
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/**
* Configures a JSlider for this model.
* If the JSlider is already configured for another model,
* it is unconfigured first.
*/
@Override
public void configureSlider(int componentIndex, JSlider slider) {
if (slider.getClientProperty("colorSliderModel") != null) {
((DefaultColorSliderModel) slider.getClientProperty("colorSliderModel")).unconfigureSlider(slider);
}
if (!(slider.getUI() instanceof ColorSliderUI)) {
slider.setUI((ColorSliderUI) ColorSliderUI.createUI(slider));
}
slider.setModel(getBoundedRangeModel(componentIndex));
slider.putClientProperty("colorSliderModel", this);
slider.putClientProperty("colorComponentIndex", componentIndex);
addColorSlider(slider);
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/**
* Configures a JSlider for this model.
* If the JSlider is already configured for another model,
* it is unconfigured first.
*/
@Override
public void configureSlider(int componentIndex, JSlider slider) {
if (slider.getClientProperty("colorSliderModel") != null) {
((DefaultColorSliderModel) slider.getClientProperty("colorSliderModel")).unconfigureSlider(slider);
}
if (!(slider.getUI() instanceof PaletteColorSliderUI)) {
slider.setUI((PaletteColorSliderUI) PaletteColorSliderUI.createUI(slider));
}
BoundedRangeModel brm = getBoundedRangeModel(componentIndex);
slider.setModel(brm);
slider.putClientProperty("colorSliderModel", this);
slider.putClientProperty("colorComponentIndex", componentIndex);
addColorSlider(slider);
}
代码示例来源:origin: com.github.insubstantial/substance
/**
* Configures a JSlider for this ColorSliderModel.
* If the JSlider is already configured for another ColorSliderModel,
* it is unconfigured first.
*/
public void configureColorSlider(int component, JSlider slider) {
if (slider.getClientProperty("ColorSliderModel") != null) {
((ColorSliderModel) slider.getClientProperty("ColorSliderModel"))
.unconfigureColorSlider(slider);
}
if ( ! (slider.getUI() instanceof ColorSliderUI)) {
slider.setUI(new ColorSliderUI(slider));
slider.createStandardLabels(16);
}
slider.setModel(getBoundedRangeModel(component));
slider.putClientProperty("ColorSliderModel", this);
slider.putClientProperty("ColorComponentIndex", component);
addColorSlider(slider);
}
内容来源于网络,如有侵权,请联系作者删除!