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

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

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

JSlider.setPaintTrack介绍

暂无

代码示例

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

public ColorSlider (Color[] paletteColors) {
  this.paletteColors = paletteColors;
  setLayout(new GridBagLayout());
  {
    slider = new JSlider(0, 1000, 0);
    slider.setPaintTrack(false);
    add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
      new Insets(0, 6, 0, 6), 0, 0));
  }
  {
    colorPicker = new ColorPicker();
    add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
      GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0));
  }
  slider.addChangeListener(new ChangeListener() {
    public void stateChanged (ChangeEvent event) {
      colorPicked();
    }
  });
}

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

public ColorSlider (Color[] paletteColors) {
  this.paletteColors = paletteColors;
  setLayout(new GridBagLayout());
  {
    slider = new JSlider(0, 1000, 0);
    slider.setPaintTrack(false);
    add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
      new Insets(0, 6, 0, 6), 0, 0));
  }
  {
    colorPicker = new ColorPicker();
    add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
      GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0));
  }
  slider.addChangeListener(new ChangeListener() {
    public void stateChanged (ChangeEvent event) {
      colorPicked();
    }
  });
}

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

public ColorSlider (Color[] paletteColors) {
  this.paletteColors = paletteColors;
  setLayout(new GridBagLayout());
  {
    slider = new JSlider(0, 1000, 0);
    slider.setPaintTrack(false);
    add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
      new Insets(0, 6, 0, 6), 0, 0));
  }
  {
    colorPicker = new ColorPicker();
    add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
      GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0));
  }
  slider.addChangeListener(new ChangeListener() {
    public void stateChanged (ChangeEvent event) {
      colorPicked();
    }
  });
}

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

public ColorSlider (Color[] paletteColors) {
  this.paletteColors = paletteColors;
  setLayout(new GridBagLayout());
  {
    slider = new JSlider(0, 1000, 0);
    slider.setPaintTrack(false);
    add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
      new Insets(0, 6, 0, 6), 0, 0));
  }
  {
    colorPicker = new ColorPicker();
    add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
      GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0));
  }
  slider.addChangeListener(new ChangeListener() {
    public void stateChanged (ChangeEvent event) {
      colorPicked();
    }
  });
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-tools

public ColorSlider (Color[] paletteColors) {
  this.paletteColors = paletteColors;
  setLayout(new GridBagLayout());
  {
    slider = new JSlider(0, 1000, 0);
    slider.setPaintTrack(false);
    add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
      new Insets(0, 6, 0, 6), 0, 0));
  }
  {
    colorPicker = new ColorPicker();
    add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
      GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0));
  }
  slider.addChangeListener(new ChangeListener() {
    public void stateChanged (ChangeEvent event) {
      colorPicked();
    }
  });
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-tools

public ColorSlider (Color[] paletteColors) {
  this.paletteColors = paletteColors;
  setLayout(new GridBagLayout());
  {
    slider = new JSlider(0, 1000, 0);
    slider.setPaintTrack(false);
    add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
      new Insets(0, 6, 0, 6), 0, 0));
  }
  {
    colorPicker = new ColorPicker();
    add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
      GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0));
  }
  slider.addChangeListener(new ChangeListener() {
    public void stateChanged (ChangeEvent event) {
      colorPicked();
    }
  });
}

代码示例来源:origin: edu.stanford.protege/org.coode.owlviz

edgeBrightness.setMinorTickSpacing(10);
edgeBrightness.setPaintTicks(true);
edgeBrightness.setPaintTrack(true);
edgeBrightness.setPaintLabels(true);
gbc.gridx = 0;

代码示例来源:origin: com.synaptix/SynaptixWidget

@Override
protected void initialize() {
  pageSizeSlider = new JSlider(min, max);
  pageSizeSlider.setPaintTicks(true);
  pageSizeSlider.setSnapToTicks(false);
  pageSizeSlider.setMinorTickSpacing(10);
  pageSizeSlider.setMajorTickSpacing(50);
  pageSizeSlider.setPaintTrack(true);
  pageSizeSlider.setPaintLabels(true);
  pageSizeSlider.setValue(min);
  Dictionary<Integer, JLabel> labels = new Hashtable<Integer, JLabel>();
  labels.put(min, new JLabel(Integer.toString(min)));
  if ((max + min) % 2 == 0) {
    labels.put((max + min) / 2, new JLabel(Integer.toString((max + min) / 2)));
  }
  labels.put(max, new JLabel(Integer.toString(max)));
  pageSizeSlider.setLabelTable(labels);
  pageSizeSlider.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      updateToleranceLabel();
    }
  });
  pageSizeLabel = new JLabel();
  updateToleranceLabel();
  super.initialize();
}

代码示例来源:origin: jfree/jcommon

this.slider.setPaintLabels(true);
this.slider.setPaintTicks(true);
this.slider.setPaintTrack(true);
this.slider.addChangeListener(this);
content.add(controls, BorderLayout.NORTH);

代码示例来源:origin: bcdev/beam

private JSlider createTimeSlider() {
  final JSlider timeSlider = new JSlider(JSlider.HORIZONTAL, 0, 0, 0);
  timeSlider.setMajorTickSpacing(stepsPerTimespan);
  timeSlider.setMinorTickSpacing(1);
  timeSlider.setPaintTrack(true);
  timeSlider.setSnapToTicks(true);
  timeSlider.setPaintTicks(true);
  timeSlider.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      final int index = timeSlider.getValue() / stepsPerTimespan;
      final List<Band> bandList = getBandList(currentView.getRaster().getName());
      final String labelText = createSliderLabelText(bandList, index);
      dateLabel.setText("Date: " + labelText);
    }
  });
  timeSlider.setPreferredSize(new Dimension(320, 60));
  return timeSlider;
}

代码示例来源:origin: bcdev/beam

private JSlider createSpeedSlider() {
  final JSlider speedSlider = new JSlider(1, 10);
  speedSlider.setToolTipText("Choose the playing speed");
  speedSlider.setSnapToTicks(true);
  speedSlider.setPaintTrack(true);
  speedSlider.setPaintTicks(true);
  speedSlider.setPaintLabels(true);
  speedSlider.setValue(6);
  speedSlider.setPreferredSize(new Dimension(80, speedSlider.getPreferredSize().height));
  speedSlider.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      timerDelay = calculateTimerDelay();
      timer.setDelay(timerDelay);
      updateSpeedUnit();
    }
  });
  return speedSlider;
}

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

slider.setPaintLabels(true);
slider.setPaintTicks(true);
slider.setPaintTrack(true);
slider.setMajorTickSpacing(100);
slider.setMinorTickSpacing(20);

代码示例来源:origin: org.zaproxy/zap

private JSlider getSliderDelayInMs() {
  if (sliderDelayInMs == null) {
    sliderDelayInMs = new JSlider();
    sliderDelayInMs.setMaximum(1000);
    sliderDelayInMs.setMinimum(0);
    sliderDelayInMs.setValue(0);
    sliderDelayInMs.setPaintTicks(true);
    sliderDelayInMs.setPaintLabels(true);
    sliderDelayInMs.setMinorTickSpacing(25);
    sliderDelayInMs.setMajorTickSpacing(100);
    sliderDelayInMs.setSnapToTicks(true);
    sliderDelayInMs.setPaintTrack(true);
    sliderDelayInMs.addChangeListener(new ChangeListener() {
      @Override
      public void stateChanged(ChangeEvent e) {
        setLabelDelayInMsValue(getSliderDelayInMs().getValue());
      }
    });
  }
  return sliderDelayInMs;
}

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

slider.setSnapToTicks(false);
slider.setPaintLabels(false);
slider.setPaintTrack(true);

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

degreesSlider.setPaintLabels(true);
degreesSlider.setPaintTicks(true);
degreesSlider.setPaintTrack(true);
degreesSlider.addMouseWheelListener(this);
getContentPane().add(degreesSlider);

代码示例来源:origin: senbox-org/snap-desktop

recordValueField = new JTextField(7);
recordSlider = new JSlider(SwingConstants.HORIZONTAL, 1, 1, 1);
recordSlider.setPaintTrack(true);
recordSlider.setPaintTicks(true);
recordSlider.setPaintLabels(true);

代码示例来源:origin: org.zaproxy/zap

/**
 * This method initializes sliderHostPerScan
 *
 * @return javax.swing.JSlider
 */
private JSlider getSliderHostPerScan() {
  if (sliderHostPerScan == null) {
    sliderHostPerScan = new JSlider();
    sliderHostPerScan.setMaximum(5);
    sliderHostPerScan.setMinimum(1);
    sliderHostPerScan.setMinorTickSpacing(1);
    sliderHostPerScan.setPaintTicks(true);
    sliderHostPerScan.setPaintLabels(true);
    sliderHostPerScan.setName("");
    sliderHostPerScan.setMajorTickSpacing(1);
    sliderHostPerScan.setSnapToTicks(true);
    sliderHostPerScan.setPaintTrack(true);
  }
  return sliderHostPerScan;
}

代码示例来源:origin: org.zaproxy/zap

/**
 * This method initializes the slider for MaxDepth.
 * 
 * @return the slider for max depth
 */
private JSlider getSliderMaxDepth() {
  if (sliderMaxDepth == null) {
    sliderMaxDepth = new JSlider();
    sliderMaxDepth.setMaximum(19);
    sliderMaxDepth.setMinimum(1);
    sliderMaxDepth.setMinorTickSpacing(1);
    sliderMaxDepth.setPaintTicks(true);
    sliderMaxDepth.setPaintLabels(true);
    sliderMaxDepth.setName("");
    sliderMaxDepth.setMajorTickSpacing(1);
    sliderMaxDepth.setSnapToTicks(true);
    sliderMaxDepth.setPaintTrack(true);
  }
  return sliderMaxDepth;
}

代码示例来源:origin: palantir/Cinch

private void styleSlider(JSlider slider) {
  slider.setMajorTickSpacing(10);
  slider.setMinorTickSpacing(1);
  slider.setPaintLabels(true);
  slider.setPaintTicks(true);
  slider.setPaintTrack(true);
  slider.setSnapToTicks(true);
}

代码示例来源:origin: org.fudaa.framework.fudaa/fudaa-common

public BSelecteurInterface[] createSelecteurs() {
 JSlider sl = new JSlider(-180, 180);
 sl.setSnapToTicks(true);
 sl.setPaintTrack(true);
 sl.setPaintLabels(true);
 sl.setMajorTickSpacing(90);
 sl.setMinorTickSpacing(5);
 BSelecteurSlider selecteurSlider = new BSelecteurSlider(PROPERTY_ROTATION, sl);
 selecteurSlider.setTitle(EbliLib.getS("Rotation"));
 BSelecteurSpinner selecteurSliderX = new BSelecteurSpinner(PROPERTY_SHEAR_X, createShearSlider());
 selecteurSliderX.setTitle(EbliLib.getS("cisaillement X"));
 BSelecteurSpinner selecteurSliderY = new BSelecteurSpinner(PROPERTY_SHEAR_Y, createShearSlider());
 selecteurSliderY.setTitle(EbliLib.getS("cisaillement Y"));
 BuButton bt = new BuButton(BuResource.BU.getIcon("reinitialiser"));
 BSelecteurButton bst = new BSelecteurButton(PROPERTY_INIT, bt);
 bst.setTitle(FudaaLib.getS("Annuler les transformations"));
 bt.setToolTipText(bst.getTitle());
 return new BSelecteurInterface[] { selecteurSlider, selecteurSliderX, selecteurSliderY, bst };
}

相关文章

JSlider类方法