Examples of LengthUnit


Examples of com.eteks.sweethome3d.model.LengthUnit

    // 1. Choose a locale that displays furniture dimensions in inches
    Locale.setDefault(Locale.US);
    // Read default user preferences
    UserPreferences preferences = new DefaultUserPreferences();
    // Check the current unit isn't centimeter
    LengthUnit currentUnit = preferences.getLengthUnit();
    assertFalse("Unit is in centimeter", currentUnit == LengthUnit.CENTIMETER);
    // Get furniture catalog
    FurnitureCatalog catalog = preferences.getFurnitureCatalog();
   
    // 2. Create a home that contains furniture matching catalog furniture
View Full Code Here

Examples of com.eteks.sweethome3d.model.LengthUnit

  /**
   * Sets the edited unit.
   */
  public void setUnit(LengthUnit unit) {
    if (unit != this.unit) {
      LengthUnit oldUnit = this.unit;
      this.unit = unit;
      this.propertyChangeSupport.firePropertyChange(Property.UNIT.name(), oldUnit, unit);
    }
  }
View Full Code Here

Examples of com.lightcrafts.ui.print.PrintLayoutModel.LengthUnit

        heightText.setListener(
            new DimensionTextField.Listener() {
                public void dimensionChanged(double height) {
                    if (! readingFromModel) {
                        writingToModel = heightText;
                        LengthUnit unit = heightUnit.getSelectedUnit();
                        model.setImageHeight(height, unit);
                        writingToModel = null;
                    }
                }
            }
View Full Code Here

Examples of com.lightcrafts.ui.print.PrintLayoutModel.LengthUnit

        widthText.setListener(
            new DimensionTextField.Listener() {
                public void dimensionChanged(double width) {
                    if (! readingFromModel) {
                        writingToModel = widthText;
                        LengthUnit unit = widthUnit.getSelectedUnit();
                        model.setImageWidth(width, unit);
                        writingToModel = null;
                    }
                }
            }
View Full Code Here

Examples of com.lightcrafts.ui.print.PrintLayoutModel.LengthUnit

        unit.addItemListener(
            new ItemListener() {
                public void itemStateChanged(ItemEvent e) {
                    if (e.getStateChange() == ItemEvent.SELECTED) {
                        double oldDim = text.getDimension();
                        LengthUnit oldUnit = text.getUnit();
                        LengthUnit newUnit = unit.getSelectedUnit();
                        double newDim =
                            newUnit.fromPoints(oldUnit.toPoints(oldDim));
                        text.setUnit(newUnit);
                        text.setDimension(newDim);
                    }
                }
            }
View Full Code Here

Examples of com.lightcrafts.ui.print.PrintLayoutModel.LengthUnit

        scaleText.setScale(scale);
    }

    private void updateHeight() {
        double h = model.getImageRect().getHeight();
        LengthUnit unit = (LengthUnit) heightUnit.getSelectedItem();
        h = unit.fromPoints(h);
        heightText.setUnit(unit);
        heightText.setDimension(h);
    }
View Full Code Here

Examples of com.lightcrafts.ui.print.PrintLayoutModel.LengthUnit

        heightText.setDimension(h);
    }

    private void updateWidth() {
        double w = model.getImageRect().getWidth();
        LengthUnit unit = (LengthUnit) widthUnit.getSelectedItem();
        w = unit.fromPoints(w);
        widthText.setUnit(unit);
        widthText.setDimension(w);
    }
View Full Code Here

Examples of com.lightcrafts.ui.print.PrintLayoutModel.LengthUnit

            public void actionPerformed(ActionEvent event) {
                InputVerifier verifier = getInputVerifier();
                if (! verifier.verify(DimensionTextField.this)) {
                    return;
                }
                LengthUnit unit = getUnit();
                final double delta = (unit == LengthUnit.POINT) ? 1 : .1;
                double dim = getDimension();
                dim += delta;
                if (dim >= 0) {
                    setDimension(dim);
                }
            }
        };
        ActionListener downAction = new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                InputVerifier verifier = getInputVerifier();
                if (! verifier.verify(DimensionTextField.this)) {
                    return;
                }
                LengthUnit unit = getUnit();
                final double delta = (unit == LengthUnit.POINT) ? 1 : .1;
                double dim = getDimension();
                dim -= delta;
                if (dim >= 0) {
                    setDimension(dim);
View Full Code Here

Examples of com.lightcrafts.ui.print.PrintLayoutModel.LengthUnit

        leftText.setListener(
            new DimensionTextField.Listener() {
                public void dimensionChanged(double left) {
                    if (! readingFromModel) {
                        writingToModel = true;
                        LengthUnit unit = leftUnit.getSelectedUnit();
                        model.setImageX(left, unit);
                        writingToModel = false;
                    }
                }
            }
View Full Code Here

Examples of com.lightcrafts.ui.print.PrintLayoutModel.LengthUnit

        topText.setListener(
            new DimensionTextField.Listener() {
                public void dimensionChanged(double top) {
                    if (! readingFromModel) {
                        writingToModel = true;
                        LengthUnit unit = topUnit.getSelectedUnit();
                        model.setImageY(top, unit);
                        writingToModel = false;
                    }
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.