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

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

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

JSlider.setSnapToTicks介绍

暂无

代码示例

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

fftSizeSlider.setMajorTickSpacing(1);
fftSizeSlider.setPaintTicks(true);
fftSizeSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
for (int i = min; i <= max; i++) {

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

fftSizeSlider.setMajorTickSpacing(1);
fftSizeSlider.setPaintTicks(true);
fftSizeSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
for (int i = min; i <= max; i++) {

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

fftSizeSlider.setMajorTickSpacing(1);
fftSizeSlider.setPaintTicks(true);
fftSizeSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
for (int i = min; i <= max; i++) {

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

fftSizeSlider.setMajorTickSpacing(1);
fftSizeSlider.setPaintTicks(true);
fftSizeSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
for (int i = min; i <= max; i++) {

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

quality.setSnapToTicks(true);
quality.setPaintTicks(true);
quality.setPaintLabels(true);

代码示例来源:origin: pentaho/pentaho-reporting

public void setSnapToTicks( final boolean b ) {
 valueSlider.setSnapToTicks( b );
}

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

public BSelecteurSlider(final String _property, final int _min, final int _max) {
 this(_property, new JSlider(_min, _max));
 slider_.setSnapToTicks(true);
}

代码示例来源:origin: magefree/mage

tooltipDelay.setPaintLabels(true);
tooltipDelay.setPaintTicks(true);
tooltipDelay.setSnapToTicks(true);
tooltipDelay.setToolTipText("<HTML>The time the appearance of the tooltip window for a card is delayed.<br>\nIf set to zero, the tooltip window won't be shown at all.");
tooltipDelay.setValue(300);
sliderFontSize.setPaintLabels(true);
sliderFontSize.setPaintTicks(true);
sliderFontSize.setSnapToTicks(true);
sliderFontSize.setToolTipText("<HTML>The size of the font used to display table text.");
sliderFontSize.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sliderChatFontSize.setPaintLabels(true);
sliderChatFontSize.setPaintTicks(true);
sliderChatFontSize.setSnapToTicks(true);
sliderChatFontSize.setToolTipText("<HTML>The size of the font used to display the chat text");
sliderChatFontSize.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sliderDialogFont.setPaintLabels(true);
sliderDialogFont.setPaintTicks(true);
sliderDialogFont.setSnapToTicks(true);
sliderDialogFont.setToolTipText("<HTML>The size of the font of messages and menues");
sliderDialogFont.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sliderEditorCardSize.setPaintLabels(true);
sliderEditorCardSize.setPaintTicks(true);
sliderEditorCardSize.setSnapToTicks(true);
sliderEditorCardSize.setToolTipText("<HTML>The size of the card in editor and the picked zone of the draft panel");
sliderEditorCardSize.setBorder(javax.swing.BorderFactory.createEtchedBorder());

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

private void webSaveChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_webSaveChanged
 
  
  // TODO add your handling code here:
  boolean b = webSaveCheckBox.isSelected();
  redSlider.setSnapToTicks(b);
  greenSlider.setSnapToTicks(b);
  blueSlider.setSnapToTicks(b);
  lastWebSaveSelectionState = b;
  /*
  redSlider.repaint();
  greenSlider.repaint();
  blueSlider.repaint();
   */
  ccModel.setWebSaveOnly(b);
  
}//GEN-LAST:event_webSaveChanged

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

private void webSaveChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_webSaveChanged
 
  
  // TODO add your handling code here:
  boolean b = webSaveCheckBox.isSelected();
  redSlider.setSnapToTicks(b);
  greenSlider.setSnapToTicks(b);
  blueSlider.setSnapToTicks(b);
  lastWebSaveSelectionState = b;
  /*
  redSlider.repaint();
  greenSlider.repaint();
  blueSlider.repaint();
   */
  ccModel.setWebSaveOnly(b);
  
}//GEN-LAST:event_webSaveChanged

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

// orientation, min, max, initial value
final JSlider slider = new JSlider(SwingConstants.HORIZONTAL, 0, 2, 1);
slider.setSnapToTicks(true); // only allow 0, 1, 2 and not in between
slider.setPaintTicks(true); // paint ticks at tick spacing interval
slider.setMajorTickSpacing(1); // set interval to 1
slider.setPaintLabels(true); // show labels on ticks

代码示例来源:origin: robo-code/robocode

private JSlider createBattlefieldSizeSlider() {
  JSlider slider = new JSlider();
  slider.setMinimum(MIN_BATTLEFIELD_SIZE);
  slider.setMaximum(MAX_BATTLEFIELD_SIZE);
  slider.setMajorTickSpacing(BATTLEFIELD_STEP_SIZE);
  slider.setSnapToTicks(true);
  slider.setPaintTicks(true);
  return slider;
}

代码示例来源: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: 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: palantir/Cinch

private void initializeInterface() {
  JPanel toPanel = new JPanel(new BorderLayout());
  toPanel.add(new JLabel("Count"), BorderLayout.WEST);
  slider.setPaintLabels(true);
  slider.setLabelTable(slider.createStandardLabels(1));
  slider.setSnapToTicks(true);
  toPanel.add(slider, BorderLayout.CENTER);
  panel.setLayout(new BorderLayout());
  panel.add(toPanel, BorderLayout.NORTH);
  checkboxPanel.setLayout(new BoxLayout(checkboxPanel, BoxLayout.Y_AXIS));
  checkboxPanel.setPreferredSize(new Dimension(200, 300));
  panel.add(checkboxPanel, BorderLayout.CENTER);
  panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
}

代码示例来源:origin: MegaMek/megamek

private JSlider buildSlider(String minMsgProperty, String maxMsgProperty, String toolTip, String title) {
  JSlider thisSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 10, 5);
  Hashtable<Integer, JLabel> sliderLabels = new Hashtable<Integer, JLabel>(3);
  sliderLabels.put(0, buildSliderLabel("0 - " + minMsgProperty));
  sliderLabels.put(10, buildSliderLabel("10 - " + maxMsgProperty));
  sliderLabels.put(5, buildSliderLabel("5"));
  thisSlider.setToolTipText(toolTip);
  thisSlider.setLabelTable(sliderLabels);
  thisSlider.setPaintLabels(true);
  thisSlider.setMinorTickSpacing(1);
  thisSlider.setMajorTickSpacing(2);
  thisSlider.setSnapToTicks(true);
  thisSlider.setBorder(new TitledBorder(new LineBorder(Color.black), title));
  thisSlider.setEnabled(true);
  return thisSlider;
}

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