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

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

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

JSlider.getPaintTicks介绍

暂无

代码示例

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

public boolean getPaintTicks() {
 return valueSlider.getPaintTicks();
}

代码示例来源: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 calculateTickRect() {
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
    tickRect.x = trackRect.x;
    tickRect.y = trackRect.y + trackRect.height;
    tickRect.width = trackRect.width;
    tickRect.height = (slider.getPaintTicks()) ? getTickLength() : 0;
  } else {
    tickRect.width = (slider.getPaintTicks()) ? getTickLength() : 0;
    if (slider.getComponentOrientation().isLeftToRight()) {
      tickRect.x = trackRect.x + trackRect.width;
    } else {
      tickRect.x = trackRect.x - tickRect.width;
    }
    tickRect.y = trackRect.y;
    tickRect.height = trackRect.height;
  }
}

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

protected void calculateTickRect() {
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
    tickRect.x = trackRect.x;
    tickRect.y = trackRect.y + trackRect.height;
    tickRect.width = trackRect.width;
    tickRect.height = (slider.getPaintTicks()) ? getTickLength() : 0;
  } else {
    tickRect.width = (slider.getPaintTicks()) ? getTickLength() : 0;
    if (slider.getComponentOrientation().isLeftToRight()) {
      tickRect.x = trackRect.x + trackRect.width;
    } else {
      tickRect.x = trackRect.x - tickRect.width;
    }
    tickRect.y = trackRect.y;
    tickRect.height = trackRect.height;
  }
}

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

@Override
protected void calculateTickRect() {
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
    tickRect.x = trackRect.x;
    // tickRect.y = trackRect.y + trackRect.height;
    tickRect.y = trackRect.y - getTickLength();
    tickRect.width = trackRect.width;
    tickRect.height = getTickLength();
    if (!slider.getPaintTicks()) {
      --tickRect.y;
      tickRect.height = 0;
    }
  } else {
    /*
     * if(! QuaquaUtilities.isLeftToRight(slider)) { tickRect.x =
     * trackRect.x + trackRect.width; tickRect.width = getTickLength();
     * } else { tickRect.width = getTickLength(); tickRect.x =
     * trackRect.x - tickRect.width; }
     */
    tickRect.width = getTickLength();
    tickRect.x = contentRect.x;// trackRect.x - tickRect.width - 1;
    tickRect.y = trackRect.y;
    tickRect.height = trackRect.height;
    if (!slider.getPaintTicks()) {
      --tickRect.x;
      tickRect.width = 0;
    }
  }
}

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

@Override
protected void calculateTickRect() {
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
    tickRect.x = trackRect.x;
    // tickRect.y = trackRect.y + trackRect.height;
    tickRect.y = trackRect.y - getTickLength();
    tickRect.width = trackRect.width;
    tickRect.height = getTickLength();
    if (!slider.getPaintTicks()) {
      --tickRect.y;
      tickRect.height = 0;
    }
  } else {
    /*
     * if(! QuaquaUtilities.isLeftToRight(slider)) { tickRect.x =
     * trackRect.x + trackRect.width; tickRect.width = getTickLength();
     * } else { tickRect.width = getTickLength(); tickRect.x =
     * trackRect.x - tickRect.width; }
     */
    tickRect.width = getTickLength();
    tickRect.x = contentRect.x;// trackRect.x - tickRect.width - 1;
    tickRect.y = trackRect.y;
    tickRect.height = trackRect.height;
    if (!slider.getPaintTicks()) {
      --tickRect.x;
      tickRect.width = 0;
    }
  }
}

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

@Override
protected void calculateLabelRect() {
  super.calculateLabelRect();
  if ((this.slider.getOrientation() == JSlider.VERTICAL)
      && !this.slider.getPaintTicks()
      && this.slider.getComponentOrientation().isLeftToRight()) {
    this.labelRect.x += 3;
  }
}

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

this.tickRect.y = this.trackRect.y + this.trackRect.height;
  this.tickRect.width = this.trackRect.width;
  this.tickRect.height = (this.slider.getPaintTicks()) ? this
      .getTickLength() : 0;
} else {
  this.tickRect.width = (this.slider.getPaintTicks()) ? this
      .getTickLength() : 0;
  if (this.slider.getComponentOrientation().isLeftToRight()) {
if (this.slider.getPaintTicks()) {
  if (this.slider.getOrientation() == JSlider.HORIZONTAL) {
    this.tickRect.y -= 3;

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

this.tickRect.y = this.trackRect.y + this.trackRect.height;
  this.tickRect.width = this.trackRect.width;
  this.tickRect.height = (this.slider.getPaintTicks()) ? this
      .getTickLength() : 0;
} else {
  this.tickRect.width = (this.slider.getPaintTicks()) ? this
      .getTickLength() : 0;
  if (this.slider.getComponentOrientation().isLeftToRight()) {
if (this.slider.getPaintTicks()) {
  if (this.slider.getOrientation() == JSlider.HORIZONTAL) {
    this.tickRect.y -= 3;

代码示例来源:origin: khuxtable/seaglass

protected void calculateTickRect() {
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
    tickRect.x = trackRect.x;
    tickRect.y = trackRect.y + trackRect.height + 2 + getTickLength();
    tickRect.width = trackRect.width;
    tickRect.height = getTickLength();
    if (!slider.getPaintTicks()) {
      --tickRect.y;
      tickRect.height = 0;
    }
  } else {
    if (SeaGlassLookAndFeel.isLeftToRight(slider)) {
      tickRect.x = trackRect.x + trackRect.width;
      tickRect.width = getTickLength();
    } else {
      tickRect.width = getTickLength();
      tickRect.x = trackRect.x - tickRect.width;
    }
    tickRect.y = trackRect.y;
    tickRect.height = trackRect.height;
    if (!slider.getPaintTicks()) {
      --tickRect.x;
      tickRect.width = 0;
    }
  }
}

代码示例来源: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: org.java.net.substance/substance

@Override
protected void calculateLabelRect() {
  super.calculateLabelRect();
  if ((this.slider.getOrientation() == JSlider.VERTICAL)
      && !this.slider.getPaintTicks()
      && this.slider.getComponentOrientation().isLeftToRight()) {
    this.labelRect.x += 3;
  }
  if (this.slider.getOrientation() == JSlider.VERTICAL) {
    this.labelRect.width = getHeightOfTallestLabel();
  }
}

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

paintTrack(graphics);
if (slider.getPaintTicks() && clip.intersects(tickRect)) {
  paintTicks(graphics);

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

if (slider.getPaintTicks())
  centerSpacing += getTickLength();
if (slider.getPaintLabels())

代码示例来源: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;

相关文章

JSlider类方法