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

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

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

JSlider.getClientProperty介绍

暂无

代码示例

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

public void stateChanged(ChangeEvent e) {
 JComponent component = (JComponent) e.getSource();
 TestbedSetting setting = (TestbedSetting) component.getClientProperty(SETTING_TAG);
 switch (setting.constraintType) {
  case BOOLEAN:
   JCheckBox box = (JCheckBox) e.getSource();
   setting.enabled = box.isSelected();
   break;
  case RANGE:
   JSlider slider = (JSlider) e.getSource();
   setting.value = slider.getValue();
   JLabel label = (JLabel) slider.getClientProperty(LABEL_TAG);
   label.setText(setting.name + ": " + setting.value);
   break;
 }
 model.getPanel().grabFocus();
}

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

public void stateChanged(ChangeEvent e) {
 JComponent component = (JComponent) e.getSource();
 TestbedSetting setting = (TestbedSetting) component.getClientProperty(SETTING_TAG);
 switch (setting.constraintType) {
  case BOOLEAN:
   JCheckBox box = (JCheckBox) e.getSource();
   setting.enabled = box.isSelected();
   break;
  case RANGE:
   JSlider slider = (JSlider) e.getSource();
   setting.value = slider.getValue();
   JLabel label = (JLabel) slider.getClientProperty(LABEL_TAG);
   label.setText(setting.name + ": " + setting.value);
   break;
 }
}

代码示例来源:origin: caprica/vlcj-player

@Override
public void stateChanged(ChangeEvent e) {
  if(e.getSource() instanceof JSlider) {
    JSlider slider = (JSlider)e.getSource();
    Integer index = (Integer)slider.getClientProperty(BAND_INDEX_PROPERTY);
    int value = slider.getValue();
    // Band...
    if(index != null) {
      equalizer.setAmp(index, value / 100f);
    }
    // Preamp...
    else {
      equalizer.setPreamp(value / 100f);
    }
    if(!applyingPreset) {
      presetComboBox.setSelectedItem(null);
    }
  }
}

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

public void paintColorTrack(Graphics g, int x, int y, int width,
    int height, int buffer) {
  int x2 = x;
  int y2 = y;
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
    x2 += width;
  } else {
    y2 += height;
  }
  if (componentIndex == null) {
    componentIndex = (Integer) slider.getClientProperty("ColorComponentIndex");
  }
  if (colorSliderModel == null) {
    colorSliderModel = (ColorSliderModel) slider.getClientProperty("ColorSliderModel");
  }
  float[] rgbRatios;
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
   rgbRatios = new float[] {0.0f, 1.0f};
  } else {
   rgbRatios = new float[] {1.0f, 0.0f};
  }
  Graphics2D gg = (Graphics2D) g.create();
  gg.setPaint(new LinearGradientPaint(x, y, x2, y2,
      new float[] {0f, 1.0f},
      new Color[] { new Color(colorSliderModel.getInterpolatedRGB(componentIndex, rgbRatios[0]), true),
             new Color(colorSliderModel.getInterpolatedRGB(componentIndex, rgbRatios[1]))}));
  gg.fillRect(x, y, width, height);
  gg.dispose();
}

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

height, buffer + 2,
    slider.getOrientation() == JSlider.HORIZONTAL);
if (slider.getClientProperty("ColorSliderModel") != null) {
  colorTrackImageProducer
      .setColorSliderModel((ColorSliderModel) slider
          .getClientProperty("ColorSliderModel"));
if (slider.getClientProperty("ColorComponentIndex") != null) {
  colorTrackImageProducer
      .setColorComponentIndex(((Integer) slider
          .getClientProperty("ColorComponentIndex"))
          .intValue());

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

Object clientProperty = slider.getClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION);
if (clientProperty == null) {
  oldValue = slider.getValue();

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

Object clientProperty = slider.getClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION);
if (clientProperty == null) {
  oldValue = slider.getValue();

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

Object clientProperty = slider.getClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION);
if (clientProperty == null) {
  oldValue = slider.getValue();

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

if (slider.getClientProperty("colorSliderModel") != null) {
  colorTrackImageProducer.setColorSliderModel((ColorSliderModel) slider.getClientProperty("colorSliderModel"));
if (slider.getClientProperty("colorComponentIndex") != null) {
  colorTrackImageProducer.setColorComponentIndex(((Integer) slider.getClientProperty("colorComponentIndex")).intValue());

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

Object clientProperty = slider.getClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION);
if (clientProperty == null) {
  oldValue = slider.getValue();

代码示例来源:origin: uk.co.caprica/vlcj

@Override
public void stateChanged(ChangeEvent e) {
  if(e.getSource() instanceof JSlider) {
    JSlider slider = (JSlider)e.getSource();
    Integer index = (Integer)slider.getClientProperty(BAND_INDEX_PROPERTY);
    int value = slider.getValue();
    // Band...
    if(index != null) {
      System.out.println(value);
      equalizer.setAmp(index, value / 100f);
    }
    // Preamp...
    else {
      equalizer.setPreamp(value / 100f);
    }
    if(!applyingPreset) {
      presetComboBox.setSelectedItem(null);
    }
  }
}

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

Object clientProperty = slider.getClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION);
if (clientProperty == null) {
  oldValue = slider.getValue();

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

Object clientProperty = slider.getClientProperty(RangeSlider.CLIENT_PROPERTY_MOUSE_POSITION);
if (clientProperty == null) {
  oldValue = slider.getValue();

代码示例来源: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类方法