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

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

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

JSlider.getInverted介绍

暂无

代码示例

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

protected boolean drawInverted() {
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
    if (slider.getComponentOrientation().isLeftToRight()) {
      return slider.getInverted();
    } else {
      return !slider.getInverted();
    }
  } else {
    return slider.getInverted();
  }
}

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

protected boolean drawInverted() {
  if (slider.getOrientation() == JSlider.HORIZONTAL) {
    if (slider.getComponentOrientation().isLeftToRight()) {
      return slider.getInverted();
    } else {
      return !slider.getInverted();
    }
  } else {
    return slider.getInverted();
  }
}

代码示例来源:origin: atarw/material-ui-swing

private Line getTrack (boolean loaded) {
  if (slider.getOrientation () == JSlider.HORIZONTAL) {
    Line left = new Line (trackRect.x, thumbRect.y + thumbRect.height / 2, thumbRect.x + thumbRect.width / 2, thumbRect.y + thumbRect.height / 2);
    Line right = new Line (thumbRect.x + thumbRect.width / 2, thumbRect.y + thumbRect.height / 2, trackRect.x + trackRect.width, thumbRect.y + thumbRect.height / 2);
    if (loaded) {
      return slider.getInverted () ? right : left;
    }
    else {
      return slider.getInverted () ? left : right;
    }
  }
  else {
    Line top = new Line (thumbRect.x + thumbRect.width / 2, trackRect.y, thumbRect.x + thumbRect.width / 2, thumbRect.y + thumbRect.height / 2);
    Line bottom = new Line (thumbRect.x + thumbRect.width / 2, thumbRect.y + thumbRect.height / 2, thumbRect.x + thumbRect.width / 2, trackRect.y + trackRect.height);
    if (loaded) {
      return slider.getInverted () ? top : bottom;
    }
    else {
      return slider.getInverted () ? bottom : top;
    }
  }
}

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

private void scroll(JSlider slider, DayWidthSliderUI ui, int direction,
      boolean isBlock) {
    boolean invert = slider.getInverted();
    if (direction == NEGATIVE_SCROLL || direction == POSITIVE_SCROLL) {
      if (invert) {
        direction = (direction == POSITIVE_SCROLL) ? NEGATIVE_SCROLL
            : POSITIVE_SCROLL;
      }
      if (isBlock) {
        ui.scrollByBlock(direction);
      } else {
        ui.scrollByUnit(direction);
      }
    } else { // MIN or MAX
      if (invert) {
        direction = (direction == MIN_SCROLL) ? MAX_SCROLL
            : MIN_SCROLL;
      }
      slider.setValue((direction == MIN_SCROLL) ? slider.getMinimum()
          : slider.getMaximum());
    }
  }
}

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

private void scroll(JSlider slider, ZoomSliderUI ui, int direction,
      boolean isBlock) {
    boolean invert = slider.getInverted();
    if (direction == NEGATIVE_SCROLL || direction == POSITIVE_SCROLL) {
      if (invert) {
        direction = (direction == POSITIVE_SCROLL) ? NEGATIVE_SCROLL
            : POSITIVE_SCROLL;
      }
      if (isBlock) {
        ui.scrollByBlock(direction);
      } else {
        ui.scrollByUnit(direction);
      }
    } else { // MIN or MAX
      if (invert) {
        direction = (direction == MIN_SCROLL) ? MAX_SCROLL
            : MIN_SCROLL;
      }
      slider.setValue((direction == MIN_SCROLL) ? slider.getMinimum()
          : slider.getMaximum());
    }
  }
}

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

@RunsInCurrentThread
final @Nonnull Point locationForValue(JSlider slider, int value) {
 Point center = new Point(slider.getWidth() / 2, slider.getHeight() / 2);
 int max = max(slider, checkNotNull(slider.getInsets()));
 int coordinate = (int) (percent(slider, value) * max);
 if (!slider.getInverted()) {
  coordinate = max - coordinate;
 }
 return update(center, coordinate);
}

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

boolean inverted = slider.getInverted();
Integer value = inverted ? getMinSliderValue(slider) :
              getMaxSliderValue(slider);

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

/**
 * @param width
 * @param height
 * @param orientation
 * @param percentFilled
 * @return
 */
private Shape getValueShape(JComponent c,int width, int height, int orientation, double percentFilled) {
  Shape s; 
  JSlider slider = (JSlider)c;
  if ((orientation == JSlider.HORIZONTAL && slider.getComponentOrientation().isLeftToRight()) || slider.getInverted()) { 
     s = shapeGenerator.createRoundRectangle(1, 1, (int) (width*percentFilled), height - 2, CornerSize.ROUND_HEIGHT);
   } else {
     s = shapeGenerator.createRoundRectangle(width-(int)(width*percentFilled), 1, width, height - 2, CornerSize.ROUND_HEIGHT);
   }
  return s;
}

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

private ComponentLocation valueToLocation(JSlider s, int value) {
  int range = s.getMaximum() - s.getMinimum();
  int x = s.getWidth()/2;
  int y = s.getHeight()/2;
  Insets insets = s.getInsets();
  float percent = (float)(value - s.getMinimum()) / range;
  if (s.getOrientation() == JSlider.VERTICAL) {
    int max = s.getHeight() - insets.top - insets.bottom - 1;
    y = (int)(percent * max);
    if (!s.getInverted()) {
      y = max - y;
    }
  }
  else {
    int max = s.getWidth() - insets.left - insets.right - 1;
    x = (int)(percent * max);
    if (s.getInverted()) {
      x = max - x;
    }
  }
  return new ComponentLocation(new Point(x, y));
}

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

boolean inverted = slider.getInverted();
Integer value = inverted ? getMinSliderValue(slider) :
              getMaxSliderValue(slider);

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

return labelY + metrics.getAscent();
} else { // vertical
  boolean inverted = slider.getInverted();
  Integer value = inverted ? getLowestValue() : getHighestValue();
  if (value != null) {

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

return labelY + metrics.getAscent();
} else { // vertical
  boolean inverted = slider.getInverted();
  Integer value = inverted ? getLowestValue() : getHighestValue();
  if (value != null) {

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

return centerY + label.getBaseline(pref.width, pref.height);
} else { // VERTICAL
  Integer value = slider.getInverted() ? getLowestValue() : getHighestValue();
  if (value != null) {
    int valueY = insetCache.top;

相关文章

JSlider类方法