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

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

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

JSlider.getMaximum介绍

暂无

代码示例

代码示例来源:origin: bonnyfone/vectalign

private void updateMorphingControls(){
  if(svgMorphing.isAnimating()){
    btnMorphAnimation.setIcon(icnPause);
    sliderMorphing.setValue((int) (svgMorphing.getCurrentStep() * sliderMorphing.getMaximum()));
    sliderMorphing.setEnabled(false);
  }
  else{
    btnMorphAnimation.setIcon(icnPlay);
    sliderMorphing.setValue((int) (svgMorphing.getCurrentStep() * sliderMorphing.getMaximum()));
    sliderMorphing.setEnabled(true);
  }
}

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

@Override
  public void actionPerformed(ActionEvent arg0) {
    sliderIncrements.setValue(
        Math.min(sliderIncrements.getMaximum(), sliderIncrements.getValue() + 1));
  }
};

代码示例来源:origin: org.ihtsdo/wb-api

private int getFineControlMin() {
  if (this.coarseControl.getValue() > this.coarseControl.getMaximum() - fineControlSize / 2) {
    return this.coarseControl.getMaximum() - fineControlSize;
  }
  if (this.coarseControl.getValue() < this.coarseControl.getMinimum() + fineControlSize / 2) {
    return this.coarseControl.getMinimum();
  }
  return this.coarseControl.getValue() - fineControlSize / 2;
}

代码示例来源:origin: org.diirt/datasource-sample

private void setIndicator(Double value) {
  int range = indicator.getMaximum() - indicator.getMinimum();
  int position = range / 2;
  if (value != null) {
    position = (int) (range * value);
  }
  indicator.setValue(position);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Set the point size for the plots
 *
 * @param pointSize the point size to use
 */
public void setPointSize(int pointSize) {
 if (pointSize <= m_pointSize.getMaximum()
  && pointSize > m_pointSize.getMinimum()) {
  m_pointSize.setValue(pointSize);
 }
}

代码示例来源:origin: Waikato/weka-trunk

/**
 * Set the point size for the plots
 *
 * @param pointSize the point size to use
 */
public void setPointSize(int pointSize) {
 if (pointSize <= m_pointSize.getMaximum()
  && pointSize > m_pointSize.getMinimum()) {
  m_pointSize.setValue(pointSize);
 }
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Set the plot size
 *
 * @param plotSize the plot size to use
 */
public void setPlotSize(int plotSize) {
 if (plotSize >= m_plotSize.getMinimum()
  && plotSize <= m_plotSize.getMaximum()) {
  m_plotSize.setValue(plotSize);
 }
}

代码示例来源:origin: com.hazelcast.simulator/visualiser

@Override
  public void mousePressed(MouseEvent e) {
    Point p = e.getPoint();
    double percent = p.y / ((double) panel.getHeight());
    int range = slider.getMaximum() - slider.getMinimum();
    double newVal = range * percent;
    int result = (int) (slider.getMaximum() - newVal);
    slider.setValue(result);
  }
});

代码示例来源:origin: org.ihtsdo/wb-api

private int getFineControlMax() {
  if (this.coarseControl.getValue() > this.coarseControl.getMaximum() - fineControlSize / 2) {
    return this.coarseControl.getMaximum();
  }
  if (this.coarseControl.getValue() < this.coarseControl.getMinimum() + fineControlSize / 2) {
    return this.coarseControl.getMinimum() + fineControlSize;
  }
  return this.coarseControl.getValue() + fineControlSize / 2;
}

代码示例来源:origin: com.hazelcast.simulator/visualizer

@Override
  public void mousePressed(MouseEvent e) {
    Point p = e.getPoint();
    double percent = p.y / ((double) panel.getHeight());
    int range = slider.getMaximum() - slider.getMinimum();
    double newVal = range * percent;
    int result = (int) (slider.getMaximum() - newVal);
    slider.setValue(result);
  }
});

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

private void configureSilderLabels(JSlider recordSlider) {
  Hashtable<Integer, JLabel> labelTable = new Hashtable<>();
  JLabel minLabel = new JLabel(String.valueOf(recordSlider.getMinimum()));
  labelTable.put(recordSlider.getMinimum(), minLabel);
  JLabel maxLabel = new JLabel(String.valueOf(recordSlider.getMaximum()));
  labelTable.put(recordSlider.getMaximum(), maxLabel);
  recordSlider.setLabelTable(labelTable);
}

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInCurrentThread
private static void checkValueInBounds(@Nonnull JSlider slider, int value) {
 int min = slider.getMinimum();
 int max = slider.getMaximum();
 if (value >= min && value <= max) {
  return;
 }
 String msg = String.format("Value <%d> is not within the JSlider bounds of <%d> and <%d>", value, min, max);
 throw new IllegalArgumentException(msg);
}

代码示例来源:origin: jawi/ols

/**
 * @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
 */
@Override
public void stateChanged( final ChangeEvent aEvent )
{
 final JSlider slider = ( JSlider )aEvent.getSource();
 final int before = slider.getValue();
 final int after = ( slider.getMaximum() - before );
 slider.setToolTipText( updateLabel( before, after ) );
}

代码示例来源:origin: lbalazscs/Pixelitor

public int getMaximum() {
  if(slider!=null)
    return slider.getMaximum();
  return ((Number) ((SpinnerNumberModel)spinner.getModel()).getMaximum() ).intValue();
}

代码示例来源:origin: com.hazelcast.simulator/visualizer

@Override
  public void mousePressed(MouseEvent e) {
    Point p = e.getPoint();
    double percent = p.x / ((double) panel.getWidth());
    int range = slider.getMaximum() - slider.getMinimum();
    double newVal = range * percent;
    int result = (int) (slider.getMinimum() + newVal);
    slider.setValue(result);
  }
});

代码示例来源:origin: com.hazelcast.simulator/visualiser

@Override
  public void mousePressed(MouseEvent e) {
    Point p = e.getPoint();
    double percent = p.x / ((double) panel.getWidth());
    int range = slider.getMaximum() - slider.getMinimum();
    double newVal = range * percent;
    int result = (int) (slider.getMinimum() + newVal);
    slider.setValue(result);
  }
});

代码示例来源:origin: pvto/konte-art

public void mouseClicked(MouseEvent e)
  {
    if (e.getButton() == MouseEvent.BUTTON1)
    {
      int val = jSlider1.getValue();
      int add =
          (e.getX() > jSlider1.getWidth() * (val - jSlider1.getMinimum()) / (jSlider1.getMaximum() - jSlider1.getMinimum()) ? 1 : -1);
      addToSlider(add);
    }
  }
});

代码示例来源:origin: org.gephi/visualization

@Override
  public void stateChanged(ChangeEvent e) {
    int cam = (int) VizController.getInstance().getVizModel().getCameraDistance();
    if (zoomSlider.getValue() != cam && cam < zoomSlider.getMaximum()) {
      GraphIO io = VizController.getInstance().getGraphIO();
      io.setCameraDistance(zoomSlider.getValue());
    }
  }
});

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

@Override
protected void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) {
  super.paintMinorTickForHorizSlider(g, tickBounds, x);
  Color original = g.getColor();
  if (valueForXPosition(x) > slider.getMaximum() - slider.getExtent()) {
    g.setColor(Color.RED);
  }
  g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + (tickLength / 2));
  g.setColor(original);
}

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

@Override
  protected void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) {
    super.paintMajorTickForHorizSlider(g, tickBounds, x);
    Color original = g.getColor();
    if (valueForXPosition(x) > slider.getMaximum() - slider.getExtent()) {
      g.setColor(Color.RED);
    }
    g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + (tickLength - 1));
    g.setColor(original);
  }
}

相关文章

JSlider类方法