javax.swing.JSlider.putClientProperty()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中javax.swing.JSlider.putClientProperty()方法的一些代码示例,展示了JSlider.putClientProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.putClientProperty()方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:putClientProperty

JSlider.putClientProperty介绍

暂无

代码示例

代码示例来源:origin: jbox2d/jbox2d

private void addSettings(JPanel argPanel, TestbedSettings argSettings, SettingType argIgnore) {
 for (TestbedSetting setting : argSettings.getSettings()) {
  if (setting.settingsType == argIgnore) {
   continue;
  }
  switch (setting.constraintType) {
   case RANGE:
    JLabel text = new JLabel(setting.name + ": " + setting.value);
    JSlider slider = new JSlider(setting.min, setting.max, setting.value);
    slider.setMaximumSize(new Dimension(200, 20));
    slider.addChangeListener(this);
    slider.setName(setting.name);
    slider.putClientProperty(SETTING_TAG, setting);
    slider.putClientProperty(LABEL_TAG, text);
    argPanel.add(text);
    argPanel.add(slider);
    break;
   case BOOLEAN:
    JCheckBox checkbox = new JCheckBox(setting.name);
    checkbox.setSelected(setting.enabled);
    checkbox.addChangeListener(this);
    checkbox.putClientProperty(SETTING_TAG, setting);
    argPanel.add(checkbox);
    break;
  }
 }
}

代码示例来源:origin: JetBrains/jediterm

public static void setSliderIsFilled(final JSlider slider, final boolean value) {
  slider.putClientProperty("JSlider.isFilled", Boolean.valueOf(value));
}

代码示例来源:origin: stackoverflow.com

JSlider slider = new JSlider();
slider.putClientProperty( "Slider.paintThumbArrowShape", Boolean.TRUE );

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

protected void fireColorChanged(int componentIndex) {
  Integer index = componentIndex;
  Color value = getColor();
  for (JSlider slider : sliders) {
    slider.putClientProperty("colorComponentChange", index);
    slider.putClientProperty("colorComponentValue", value);
  }
}

代码示例来源:origin: com.github.insubstantial/substance

protected void fireColorChanged(int componentIndex) {
  Integer index = componentIndex;
  Color value = getColor();
  for (Iterator i = sliders.iterator(); i.hasNext(); ) {
    JSlider slider = (JSlider) i.next();
    slider.putClientProperty("ColorComponentChange", index);
    slider.putClientProperty("ColorComponentValue", value);
  }
}
public void fireStateChanged() {

代码示例来源:origin: org.java.net.substance/substance

protected void fireColorChanged(int componentIndex) {
  Integer index = new Integer(componentIndex);
  Color value = getColor();
  for (Iterator i = sliders.iterator(); i.hasNext(); ) {
    JSlider slider = (JSlider) i.next();
    slider.putClientProperty("ColorComponentChange", index);
    slider.putClientProperty("ColorComponentValue", value);
  }
}
public void fireStateChanged() {

代码示例来源:origin: org.java.net.substance/substance

/**
 * Unconfigures a JSlider from this ColorSliderModel.
 */
public void unconfigureColorSlider(JSlider slider) {
  if (slider.getClientProperty("ColorSliderModel") == this) {
    // XXX - This creates a NullPointerException ??
    //slider.setUI((SliderUI) UIManager.getUI(slider));
    slider.setModel(new DefaultBoundedRangeModel());
    slider.putClientProperty("ColorSliderModel", null);
    slider.putClientProperty("ColorComponentIndex", null);
    removeColorSlider(slider);
  }
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Unconfigures a JSlider from this ColorSliderModel.
 */
public void unconfigureColorSlider(JSlider slider) {
  if (slider.getClientProperty("ColorSliderModel") == this) {
    // XXX - This creates a NullPointerException ??
    //slider.setUI((SliderUI) UIManager.getUI(slider));
    slider.setModel(new DefaultBoundedRangeModel());
    slider.putClientProperty("ColorSliderModel", null);
    slider.putClientProperty("ColorComponentIndex", null);
    removeColorSlider(slider);
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/**
 * Unconfigures a JSlider from this model.
 */
@Override
public void unconfigureSlider(JSlider slider) {
  if (slider.getClientProperty("colorSliderModel") == this) {
    // XXX - This creates a NullPointerException ??
    //slider.setUI((SliderUI) UIManager.getUI(slider));
    slider.setModel(new DefaultBoundedRangeModel());
    slider.putClientProperty("colorSliderModel", null);
    slider.putClientProperty("colorComponentIndex", null);
    removeColorSlider(slider);
  }
}

代码示例来源:origin: org.jbox2d/jbox2d-testbed

private void addSettings(JPanel argPanel, TestbedSettings argSettings, SettingType argIgnore) {
 for (TestbedSetting setting : argSettings.getSettings()) {
  if (setting.settingsType == argIgnore) {
   continue;
  }
  switch (setting.constraintType) {
   case RANGE:
    JLabel text = new JLabel(setting.name + ": " + setting.value);
    JSlider slider = new JSlider(setting.min, setting.max, setting.value);
    slider.setMaximumSize(new Dimension(200, 20));
    slider.addChangeListener(this);
    slider.setName(setting.name);
    slider.putClientProperty(SETTING_TAG, setting);
    slider.putClientProperty(LABEL_TAG, text);
    argPanel.add(text);
    argPanel.add(slider);
    break;
   case BOOLEAN:
    JCheckBox checkbox = new JCheckBox(setting.name);
    checkbox.setSelected(setting.enabled);
    checkbox.addChangeListener(this);
    checkbox.putClientProperty(SETTING_TAG, setting);
    argPanel.add(checkbox);
    break;
  }
 }
}

代码示例来源:origin: com.jidesoft/jide-oss

slider.putClientProperty(RangeSlider.CLIENT_PROPERTY_ADJUST_ACTION, "scrollByUnit");
if (clientProperty == null) {
  slider.setValue(Math.max(Math.min(oldValue + delta, slider.getMaximum()), slider.getMinimum()));
  ((RangeSlider) slider).setHighValue(Math.max(Math.min(oldValue + delta, slider.getMaximum()), slider.getMinimum()));
slider.putClientProperty(RangeSlider.CLIENT_PROPERTY_ADJUST_ACTION, null);

代码示例来源:origin: Exslims/MercuryTrade

slider.putClientProperty("Slider.paintThumbArrowShape", Boolean.TRUE);
progress1.setModel(slider.getModel());

代码示例来源: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: com.jidesoft/jide-oss

/**
 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
 */
@Override
public void mousePressed(MouseEvent e) {
  if (!slider.isEnabled()) {
    return;
  }
  if (slider.isRequestFocusEnabled()) {
    slider.requestFocus();
  }
  handle = getMouseHandle(e.getX(), e.getY());
  setMousePressed(handle);
  if (handle == MOUSE_HANDLE_MAX || handle == MOUSE_HANDLE_MIN || handle == MOUSE_HANDLE_MIDDLE) {
    handleOffset = (slider.getOrientation() == JSlider.VERTICAL) ?
        e.getY() - yPositionForValue(((RangeSlider) slider).getLowValue()) :
        e.getX() - xPositionForValue(((RangeSlider) slider).getLowValue());
    mouseStartLocation = (slider.getOrientation() == JSlider.VERTICAL) ? e.getY() : e.getX();
    slider.getModel().setValueIsAdjusting(true);
  }
  else if (handle == MOUSE_HANDLE_LOWER || handle == MOUSE_HANDLE_UPPER) {
    _listener.mousePressed(e);
    slider.putClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION, null);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
 */
@Override
public void mousePressed(MouseEvent e) {
  if (!slider.isEnabled()) {
    return;
  }
  if (slider.isRequestFocusEnabled()) {
    slider.requestFocus();
  }
  handle = getMouseHandle(e.getX(), e.getY());
  setMousePressed(handle);
  if (handle == MOUSE_HANDLE_MAX || handle == MOUSE_HANDLE_MIN || handle == MOUSE_HANDLE_MIDDLE || handle == MOUSE_HANDLE_BOTH) {
    handleOffset = (slider.getOrientation() == JSlider.VERTICAL) ?
        e.getY() - yPositionForValue(((RangeSlider) slider).getLowValue()) :
        e.getX() - xPositionForValue(((RangeSlider) slider).getLowValue());
    mouseStartLocation = (slider.getOrientation() == JSlider.VERTICAL) ? e.getY() : e.getX();
    slider.getModel().setValueIsAdjusting(true);
  }
  else if (handle == MOUSE_HANDLE_LOWER || handle == MOUSE_HANDLE_UPPER) {
    _listener.mousePressed(e);
    slider.putClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION, null);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
 */
@Override
public void mousePressed(MouseEvent e) {
  if (!slider.isEnabled()) {
    return;
  }
  if (slider.isRequestFocusEnabled()) {
    slider.requestFocus();
  }
  handle = getMouseHandle(e.getX(), e.getY());
  setMousePressed(handle);
  if (handle == MOUSE_HANDLE_MAX || handle == MOUSE_HANDLE_MIN || handle == MOUSE_HANDLE_MIDDLE || handle == MOUSE_HANDLE_BOTH) {
    handleOffset = (slider.getOrientation() == JSlider.VERTICAL) ?
        e.getY() - yPositionForValue(((RangeSlider) slider).getLowValue()) :
        e.getX() - xPositionForValue(((RangeSlider) slider).getLowValue());
    mouseStartLocation = (slider.getOrientation() == JSlider.VERTICAL) ? e.getY() : e.getX();
    slider.getModel().setValueIsAdjusting(true);
  }
  else if (handle == MOUSE_HANDLE_LOWER || handle == MOUSE_HANDLE_UPPER) {
    _listener.mousePressed(e);
    slider.putClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION, null);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
 */
@Override
public void mousePressed(MouseEvent e) {
  if (!slider.isEnabled()) {
    return;
  }
  if (slider.isRequestFocusEnabled()) {
    slider.requestFocus();
  }
  handle = getMouseHandle(e.getX(), e.getY());
  setMousePressed(handle);
  if (handle == MOUSE_HANDLE_MAX || handle == MOUSE_HANDLE_MIN || handle == MOUSE_HANDLE_MIDDLE || handle == MOUSE_HANDLE_BOTH) {
    handleOffset = (slider.getOrientation() == JSlider.VERTICAL) ?
        e.getY() - yPositionForValue(((RangeSlider) slider).getLowValue()) :
        e.getX() - xPositionForValue(((RangeSlider) slider).getLowValue());
    mouseStartLocation = (slider.getOrientation() == JSlider.VERTICAL) ? e.getY() : e.getX();
    slider.getModel().setValueIsAdjusting(true);
  }
  else if (handle == MOUSE_HANDLE_LOWER || handle == MOUSE_HANDLE_UPPER) {
    _listener.mousePressed(e);
    slider.putClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION, null);
  }
}

代码示例来源: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);
}

相关文章

JSlider类方法