public SizeScaleDialog(
      final JFrame frame,
      final String dimensionName,
      boolean autoRange,
      double fromValue,
      double toValue,
      final double fromWidth,
      final double toWidth) {
    this.frame = frame;

    this.dimensionName = dimensionName;

    autoScaleCheck = new JCheckBox("Auto-scale range");
    autoScaleCheck.setSelected(autoRange);

    fromLabel = new JLabel("Range from:");
    fromNumberField = new RealNumberField();
    fromNumberField.setColumns(10);
    fromNumberField.setValue(fromValue);

    toLabel = new JLabel("to:");
    toNumberField = new RealNumberField();
    toNumberField.setColumns(10);
    toNumberField.setValue(toValue);

    fromLabel.setEnabled(false);
    fromNumberField.setEnabled(false);
    toLabel.setEnabled(false);
    toNumberField.setEnabled(false);

    fromSizeField = new RealNumberField();
    fromSizeField.setColumns(4);
    fromSizeField.setValue(fromWidth);
    toSizeField = new RealNumberField();
    toSizeField.setColumns(4);
    toSizeField.setValue(toWidth);

    autoScaleCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            boolean enabled = !autoScaleCheck.isSelected();
            fromLabel.setEnabled(enabled);
            fromNumberField.setEnabled(enabled);
            toLabel.setEnabled(enabled);
            toNumberField.setEnabled(enabled);
          }
        });
  }
Example #2
0
  public WidthScaleDialog(
      final JFrame frame,
      boolean autoRange,
      double fromValue,
      double toValue,
      final double fromWidth,
      final double toWidth) {
    this.frame = frame;

    autoScaleCheck = new JCheckBox("Auto-scale range");
    autoScaleCheck.setSelected(autoRange);

    fromLabel = new JLabel("Range from:");
    fromNumberField = new RealNumberField();
    fromNumberField.setColumns(10);
    fromNumberField.setValue(fromValue);

    toLabel = new JLabel("to:");
    toNumberField = new RealNumberField();
    toNumberField.setColumns(10);
    toNumberField.setValue(toValue);

    fromLabel.setEnabled(false);
    fromNumberField.setEnabled(false);
    toLabel.setEnabled(false);
    toNumberField.setEnabled(false);

    fromWidthField = new RealNumberField();
    fromWidthField.setColumns(4);
    fromWidthField.setValue(fromWidth);
    toWidthField = new RealNumberField();
    toWidthField.setColumns(4);
    toWidthField.setValue(toWidth);

    autoScaleCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            boolean enabled = !autoScaleCheck.isSelected();
            fromLabel.setEnabled(enabled);
            fromNumberField.setEnabled(enabled);
            toLabel.setEnabled(enabled);
            toNumberField.setEnabled(enabled);
          }
        });
  }
Example #3
0
 public Number getToWidth() {
   return toWidthField.getValue();
 }
Example #4
0
 public Number getFromWidth() {
   return fromWidthField.getValue();
 }
Example #5
0
 public Number getToValue() {
   return toNumberField.getValue();
 }
Example #6
0
 public Number getFromValue() {
   return fromNumberField.getValue();
 }