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

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

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

JSlider.getPaintLabels介绍

暂无

代码示例

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

/**
 * Returns the thumb icon for the associated slider.
 * 
 * @return The thumb icon for the associated slider.
 */
protected Icon getIcon() {
  if (this.slider.getOrientation() == JSlider.HORIZONTAL) {
    if (this.slider.getPaintTicks() || this.slider.getPaintLabels())
      return this.horizontalIcon;
    else
      return this.roundIcon;
  } else {
    if (this.slider.getPaintTicks() || this.slider.getPaintLabels())
      return this.verticalIcon;
    else
      return this.roundIcon;
  }
}

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

/**
 * Returns the thumb icon for the associated slider.
 * 
 * @return The thumb icon for the associated slider.
 */
protected Icon getIcon() {
  if (this.slider.getOrientation() == JSlider.HORIZONTAL) {
    if (this.slider.getPaintTicks() || this.slider.getPaintLabels())
      return this.horizontalIcon;
    else
      return this.roundIcon;
  } else {
    if (this.slider.getPaintTicks() || this.slider.getPaintLabels())
      return this.verticalIcon;
    else
      return this.roundIcon;
  }
}

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

protected void calculateTrackBuffer() {
  if (slider.getPaintLabels() && slider.getLabelTable() != null) {
    Component highLabel = getHighestValueLabel();
    Component lowLabel = getLowestValueLabel();
    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      trackBuffer = Math.max(highLabel.getBounds().width, lowLabel
          .getBounds().width) / 2;
      trackBuffer = Math.max(trackBuffer, thumbRect.width / 2);
    } else {
      trackBuffer = Math.max(highLabel.getBounds().height, lowLabel
          .getBounds().height) / 2;
      trackBuffer = Math.max(trackBuffer, thumbRect.height / 2);
    }
  } else {
    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      trackBuffer = thumbRect.width / 2;
    } else {
      trackBuffer = thumbRect.height / 2;
    }
  }
}

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

protected void calculateTrackBuffer() {
  if (slider.getPaintLabels() && slider.getLabelTable() != null) {
    Component highLabel = getHighestValueLabel();
    Component lowLabel = getLowestValueLabel();
    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      trackBuffer = Math.max(highLabel.getBounds().width, lowLabel
          .getBounds().width) / 2;
      trackBuffer = Math.max(trackBuffer, thumbRect.width / 2);
    } else {
      trackBuffer = Math.max(highLabel.getBounds().height, lowLabel
          .getBounds().height) / 2;
      trackBuffer = Math.max(trackBuffer, thumbRect.height / 2);
    }
  } else {
    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      trackBuffer = thumbRect.width / 2;
    } else {
      trackBuffer = thumbRect.height / 2;
    }
  }
}

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

public void paint(Graphics g, JComponent c) {
  recalculateIfInsetsChanged();
  recalculateIfOrientationChanged();
  Rectangle clip = g.getClipBounds();
  if (!clip.intersects(trackRect) && slider.getPaintTrack())
    calculateGeometry();
  if (slider.getPaintTrack() && clip.intersects(trackRect)) {
    paintTrack(g);
  }
  if (slider.getPaintTicks() && clip.intersects(tickRect)) {
    paintTicks(g);
  }
  if (slider.getPaintLabels() && clip.intersects(labelRect)) {
    paintLabels(g);
  }
  if (slider.hasFocus() && clip.intersects(focusRect)) {
    paintFocus(g);
  }
  if (clip.intersects(thumbRect)) {
    paintThumb(g);
  }
}

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

@Override
public Dimension getPreferredSize(JComponent c) {
  this.recalculateIfInsetsChanged();
  Dimension d;
  if (this.slider.getOrientation() == JSlider.VERTICAL) {
    d = new Dimension(this.getPreferredVerticalSize());
    d.width = this.insetCache.left + this.insetCache.right;
    d.width += this.focusInsets.left + this.focusInsets.right;
    d.width += this.trackRect.width;
    if (this.slider.getPaintTicks())
      d.width += getTickLength();
    if (this.slider.getPaintLabels())
      d.width += getWidthOfWidestLabel();
    d.width += 3;
  } else {
    d = new Dimension(this.getPreferredHorizontalSize());
    d.height = this.insetCache.top + this.insetCache.bottom;
    d.height += this.focusInsets.top + this.focusInsets.bottom;
    d.height += this.trackRect.height;
    if (this.slider.getPaintTicks())
      d.height += getTickLength();
    if (this.slider.getPaintLabels())
      d.height += getHeightOfTallestLabel();
    d.height += 3;
  }
  return d;
}

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

public void paint(Graphics g, JComponent c) {
  recalculateIfInsetsChanged();
  recalculateIfOrientationChanged();
  Rectangle clip = g.getClipBounds();
  if (!clip.intersects(trackRect) && slider.getPaintTrack())
    calculateGeometry();
  if (slider.getPaintTrack() && clip.intersects(trackRect)) {
    paintTrack(g);
  }
  if (slider.getPaintTicks() && clip.intersects(tickRect)) {
    paintTicks(g);
  }
  if (slider.getPaintLabels() && clip.intersects(labelRect)) {
    paintLabels(g);
  }
  if (slider.hasFocus() && clip.intersects(focusRect)) {
    paintFocus(g);
  }
  if (clip.intersects(thumbRect)) {
    paintThumb(g);
  }
}

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

@Override
public Dimension getPreferredSize(JComponent c) {
  this.recalculateIfInsetsChanged();
  Dimension d;
  if (this.slider.getOrientation() == JSlider.VERTICAL) {
    d = new Dimension(this.getPreferredVerticalSize());
    d.width = this.insetCache.left + this.insetCache.right;
    d.width += this.focusInsets.left + this.focusInsets.right;
    d.width += this.trackRect.width;
    if (this.slider.getPaintTicks())
      d.width += getTickLength();
    if (this.slider.getPaintLabels())
      d.width += getWidthOfWidestLabel();
    d.width += 3;
  } else {
    d = new Dimension(this.getPreferredHorizontalSize());
    d.height = this.insetCache.top + this.insetCache.bottom;
    d.height += this.focusInsets.top + this.focusInsets.bottom;
    d.height += this.trackRect.height;
    if (this.slider.getPaintTicks())
      d.height += getTickLength();
    if (this.slider.getPaintLabels())
      d.height += getHeightOfTallestLabel();
    d.height += 3;
  }
  return d;
}

代码示例来源:origin: nroduit/Weasis

final int spacing = space < 1 ? 1 : space;
if (!slider.getPaintLabels()) {
  return;

代码示例来源:origin: com.jtattoo/JTattoo

public void paint(Graphics g, JComponent c) {
  paintBackground(g, c);
  recalculateIfInsetsChanged();
  recalculateIfOrientationChanged();
  Rectangle clip = g.getClipBounds();
  
  if ( !clip.intersects(trackRect) && slider.getPaintTrack()) {
    calculateGeometry();
  }
  
  if (slider.getPaintTrack() && clip.intersects(trackRect)) {
    paintTrack(g);
  }
  if (slider.getPaintTicks() && clip.intersects(tickRect)) {
    paintTicks(g);
  }
  if (slider.getPaintLabels() && clip.intersects(labelRect)) {
    paintLabels(g);
  }
  if (slider.hasFocus() && clip.intersects(focusRect)) {
    paintFocus(g);
  }
  if (clip.intersects(thumbRect)) {
    paintThumb(g);
  }
}

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

if (slider.getPaintLabels() && clip.intersects(labelRect)) {
  paintLabels(graphics);

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

if (slider.getPaintTicks())
  centerSpacing += getTickLength();
if (slider.getPaintLabels())
  centerSpacing += getHeightOfTallestLabel();
trackRect.x = contentRect.x + trackBuffer + 1;

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

if (slider.getPaintLabels() && clip.intersects(labelRect)) {
  paintLabels(graphics);

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

centerSpacing += getTickLength();
  if (slider.getPaintLabels()) {
centerSpacing += getHeightOfTallestLabel();

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

if (slider.getPaintTicks())
  centerSpacing += getTickLength();
if (slider.getPaintLabels())
  centerSpacing += getHeightOfTallestLabel();
trackRect.x = contentRect.x + trackBuffer;
  if (slider.getPaintTicks())
    centerSpacing += getTickLength();
  if (slider.getPaintLabels())
    centerSpacing += getWidthOfWidestLabel();
} else {
  if (slider.getPaintTicks())
    centerSpacing -= getTickLength();
  if (slider.getPaintLabels())
    centerSpacing -= getWidthOfWidestLabel();

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

if (slider.getPaintLabels()) {
  centerSpacing += getHeightOfTallestLabel();

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

if (slider.getPaintTicks())
  centerSpacing += getTickLength();
if (slider.getPaintLabels())
  centerSpacing += getHeightOfTallestLabel();
trackRect.x = contentRect.x + trackBuffer;
  if (slider.getPaintTicks())
    centerSpacing += getTickLength();
  if (slider.getPaintLabels())
    centerSpacing += getWidthOfWidestLabel();
} else {
  if (slider.getPaintTicks())
    centerSpacing -= getTickLength();
  if (slider.getPaintLabels())
    centerSpacing -= getWidthOfWidestLabel();

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

return new Rectangle(this.trackRect.x + trackLeft, trackTop, trackRight - trackLeft, trackBottom - trackTop);
} else {
  if (this.slider.getPaintLabels() || this.slider.getPaintTicks()) {
    if (this.slider.getComponentOrientation().isLeftToRight()) {
      trackLeft = trackRect.x + this.insetCache.left + this.focusInsets.left;

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

protected void calculateLabelRect() {
  if (slider.getPaintLabels()) {
    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      labelRect.x = tickRect.x - trackBuffer;

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

protected void calculateLabelRect() {
  if (slider.getPaintLabels()) {
    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      labelRect.x = tickRect.x - trackBuffer;

相关文章

JSlider类方法