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

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

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

JSlider.getExtent介绍

暂无

代码示例

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

public void stateChanged(ChangeEvent e) {
    try {
      setter.getMethod().invoke(model1, slider.getExtent());
    } catch (Exception ex) {
      logger.error("could not invoke JSlider binding", ex);
    }
  }
};

代码示例来源:origin: org.gephi/ui-components

int trackTop = trackRect.y;
int trackBottom = trackRect.y + (trackRect.height - 1);
int vMax = yPositionForValue(slider.getValue() + slider.getExtent());
int trackLeft = trackRect.x;
int trackRight = trackRect.x + (trackRect.width - 1);
int hMax = xPositionForValue(slider.getValue() + slider.getExtent());

代码示例来源:origin: igvteam/igv

int trackTop = trackRect.y;
int trackBottom = trackRect.y + (trackRect.height - 1);
int vMax = yPositionForValue(slider.getValue() + slider.getExtent());
int trackLeft = trackRect.x;
int trackRight = trackRect.x + (trackRect.width - 1);
int hMax = xPositionForValue(slider.getValue() + slider.getExtent());

代码示例来源:origin: org.gephi/ui-components

int trackTop = trackRect.y;
int trackBottom = trackRect.y + (trackRect.height - 1);
int vMax = yPositionForValue(slider.getValue() + slider.getExtent());
int trackLeft = trackRect.x;
int trackRight = trackRect.x + (trackRect.width - 1);
int hMax = xPositionForValue(slider.getValue() + slider.getExtent());

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

代码示例来源:origin: org.gephi/ui-components

int upperValue = slider.getValue() + slider.getExtent();
int snappedValue = upperValue;
int majorTickSpacing = slider.getMajorTickSpacing();
int upperPosition = xPositionForValue(slider.getValue() + slider.getExtent());
upperThumbRect.x = upperPosition - (upperThumbRect.width / 2);
upperThumbRect.y = trackRect.y;
int upperPosition = yPositionForValue(slider.getValue() + slider.getExtent());
upperThumbRect.x = trackRect.x;
upperThumbRect.y = upperPosition - (upperThumbRect.height / 2);

代码示例来源:origin: igvteam/igv

int upperValue = slider.getValue() + slider.getExtent();
int snappedValue = upperValue;
int majorTickSpacing = slider.getMajorTickSpacing();
int upperPosition = xPositionForValue(slider.getValue() + slider.getExtent());
upperThumbRect.x = upperPosition - (upperThumbRect.width / 2);
upperThumbRect.y = trackRect.y;
int upperPosition = yPositionForValue(slider.getValue() + slider.getExtent());
upperThumbRect.x = trackRect.x;
upperThumbRect.y = upperPosition - (upperThumbRect.height / 2);

代码示例来源:origin: org.gephi/ui-components

int upperValue = slider.getValue() + slider.getExtent();
int snappedValue = upperValue;
int majorTickSpacing = slider.getMajorTickSpacing();
int upperPosition = xPositionForValue(slider.getValue() + slider.getExtent());
upperThumbRect.x = upperPosition - (upperThumbRect.width / 2);
upperThumbRect.y = trackRect.y;
int upperPosition = yPositionForValue(slider.getValue() + slider.getExtent());
upperThumbRect.x = trackRect.x;
upperThumbRect.y = upperPosition - (upperThumbRect.height / 2);

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

public boolean shouldScroll(int direction) {
  Rectangle r = thumbRect;
  if (slider.getOrientation() == JSlider.VERTICAL) {
    if (drawInverted() ? direction < 0 : direction > 0) {
      if (r.y <= currentMouseY) {
        return false;
      }
    } else if (r.y + r.height >= currentMouseY) {
      return false;
    }
  } else {
    if (drawInverted() ? direction < 0 : direction > 0) {
      if (r.x + r.width >= currentMouseX) {
        return false;
      }
    } else if (r.x <= currentMouseX) {
      return false;
    }
  }
  if (direction > 0
      && slider.getValue() + slider.getExtent() >= slider
          .getMaximum()) {
    return false;
  } else if (direction < 0
      && slider.getValue() <= slider.getMinimum()) {
    return false;
  }
  return true;
}

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

public boolean shouldScroll(int direction) {
  Rectangle r = thumbRect;
  if (slider.getOrientation() == JSlider.VERTICAL) {
    if (drawInverted() ? direction < 0 : direction > 0) {
      if (r.y <= currentMouseY) {
        return false;
      }
    } else if (r.y + r.height >= currentMouseY) {
      return false;
    }
  } else {
    if (drawInverted() ? direction < 0 : direction > 0) {
      if (r.x + r.width >= currentMouseX) {
        return false;
      }
    } else if (r.x <= currentMouseX) {
      return false;
    }
  }
  if (direction > 0
      && slider.getValue() + slider.getExtent() >= slider
          .getMaximum()) {
    return false;
  } else if (direction < 0
      && slider.getValue() <= slider.getMinimum()) {
    return false;
  }
  return true;
}

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

int trackTop = trackRect.y;
int trackBottom = trackRect.y + trackRect.height - halfThumbHeight - trackBorder;
int vMax = yPositionForValue(slider.getMaximum() - slider.getExtent());
int trackLeft = trackRect.x + halfThumbWidth + trackBorder;
int trackRight = trackRect.x + trackRect.width - halfThumbWidth - trackBorder;
int hMax = xPositionForValue(slider.getMaximum() - slider.getExtent());

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

int trackBottom = trackRect.y + (trackRect.height - 1);
int vMax = yPositionForValue(slider.getMaximum()
    - slider.getExtent());
int trackRight = trackRect.x + (trackRect.width - 1);
int hMax = xPositionForValue(slider.getMaximum()
    - slider.getExtent());

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

int trackBottom = trackRect.y + (trackRect.height - 1);
int vMax = yPositionForValue(slider.getMaximum()
    - slider.getExtent());
int trackRight = trackRect.x + (trackRect.width - 1);
int hMax = xPositionForValue(slider.getMaximum()
    - slider.getExtent());

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

int oldExtent = getExtent();
super.setExtent(extent);
firePropertyChange(EXTENT_PROPERTY, Integer.valueOf(oldExtent), Integer.valueOf(extent));

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

@Override
protected void paintHorizontalLabel(Graphics g, int value, Component label) {
  final int extentLowerBound = slider.getMaximum() - slider.getExtent();
  setOriginalLabelColor(label.getForeground());
  if (value > extentLowerBound) {
    label.setForeground(Color.RED);
  } else {
    label.setForeground(originalLabelColor);
  }
  super.paintHorizontalLabel(g, value, label);
}

相关文章

JSlider类方法