Class QuantityInputField<Q extends javax.measure.Quantity<Q>>

java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.control.Control
com.dlsc.unitfx.QuantityInputControl<Q>
com.dlsc.unitfx.QuantityInputField<Q>
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget, javafx.scene.control.Skinnable

public class QuantityInputField<Q extends javax.measure.Quantity<Q>>
extends QuantityInputControl<Q>
Concrete implementation of QuantityInputControl that uses a NumberInputField to let users enter values.
  • Property Summary

    Properties 
    Type Property Description
    javafx.beans.property.BooleanProperty allowNegatives
    Boolean property that tells the control to allow introducing a negative quantity.
    javafx.beans.property.BooleanProperty autoFixValue
    Boolean property used to automatically convert the QuantityInputControl.valueProperty() when the QuantityInputControl.unitProperty() is changed.
    javafx.beans.property.ReadOnlyBooleanProperty invalid
    Property that indicates when the value entered violates restrictions of minimum and maximum values.
    javafx.beans.property.ObjectProperty<Double> maximumValue
    The maximum value that can be entered in this field.
    javafx.beans.property.ObjectProperty<Double> minimumValue
    The minimum value that can be entered in this field.
    javafx.beans.property.ObjectProperty<Double> precision
    Integer used to truncate the value entered by the user and calculate the quantity.
    javafx.beans.property.ReadOnlyObjectProperty<javax.measure.Quantity<Q>> precisionQuantity
    Represents the precision as combination of precisionProperty() ()} and precisionUnitProperty().
    javafx.beans.property.ObjectProperty<javax.measure.Unit<Q>> precisionUnit
    Represents the system base unit, which is the default one for the control.
    javafx.beans.property.ReadOnlyBooleanProperty valueDirty
    Boolean property that indicates when the value and the valueQuantity are different because after a precision was applied.
    javafx.beans.property.ObjectProperty<Predicate<Double>> valueValidator
    Stores a validator object for the value converted from text entered.

    Properties inherited from class javafx.scene.control.Control

    contextMenu, skin, tooltip

    Properties inherited from class javafx.scene.layout.Region

    background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width

    Properties inherited from class javafx.scene.Parent

    needsLayout

    Properties inherited from class javafx.scene.Node

    accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
  • Field Summary

    Fields inherited from class javafx.scene.layout.Region

    USE_COMPUTED_SIZE, USE_PREF_SIZE

    Fields inherited from class javafx.scene.Node

    BASELINE_OFFSET_SAME_AS_HEIGHT
  • Constructor Summary

    Constructors 
    Constructor Description
    QuantityInputField()
    Instances a new input field with no available units, null value and no precision.
  • Method Summary

    Modifier and Type Method Description
    javafx.beans.property.BooleanProperty allowNegativesProperty()
    Boolean property that tells the control to allow introducing a negative quantity.
    javafx.beans.property.BooleanProperty autoFixValueProperty()
    Boolean property used to automatically convert the QuantityInputControl.valueProperty() when the QuantityInputControl.unitProperty() is changed.
    protected javafx.scene.control.Skin<?> createDefaultSkin()  
    Double getMaximumValue()
    Gets the value of the property maximumValue.
    Double getMinimumValue()
    Gets the value of the property minimumValue.
    Double getPrecision()
    Gets the value of the property precision.
    javax.measure.Quantity<Q> getPrecisionQuantity()
    Gets the value of the property precisionQuantity.
    javax.measure.Unit<Q> getPrecisionUnit()
    Gets the value of the property precisionUnit.
    String getUserAgentStylesheet()  
    Predicate<Double> getValueValidator()
    Gets the value of the property valueValidator.
    javafx.beans.property.ReadOnlyBooleanProperty invalidProperty()
    Property that indicates when the value entered violates restrictions of minimum and maximum values.
    boolean isAllowNegatives()
    Gets the value of the property allowNegatives.
    boolean isAutoFixValue()
    Gets the value of the property autoFixValue.
    boolean isInvalid()
    Gets the value of the property invalid.
    boolean isValueDirty()
    Gets the value of the property valueDirty.
    javafx.beans.property.ObjectProperty<Double> maximumValueProperty()
    The maximum value that can be entered in this field.
    javafx.beans.property.ObjectProperty<Double> minimumValueProperty()
    The minimum value that can be entered in this field.
    javafx.beans.property.ObjectProperty<Double> precisionProperty()
    Integer used to truncate the value entered by the user and calculate the quantity.
    javafx.beans.property.ReadOnlyObjectProperty<javax.measure.Quantity<Q>> precisionQuantityProperty()
    Represents the precision as combination of precisionProperty() ()} and precisionUnitProperty().
    javafx.beans.property.ObjectProperty<javax.measure.Unit<Q>> precisionUnitProperty()
    Represents the system base unit, which is the default one for the control.
    void restoreValueProperty()
    void setAllowNegatives​(boolean allowNegatives)
    Sets the value of the property allowNegatives.
    void setAutoFixValue​(boolean autoFixValue)
    Sets the value of the property autoFixValue.
    void setMaximumValue​(Double maximumValue)
    Sets the value of the property maximumValue.
    void setMinimumValue​(Double minimumValue)
    Sets the value of the property minimumValue.
    void setPrecision​(Double precision)
    Sets the value of the property precision.
    void setPrecisionUnit​(javax.measure.Unit<Q> precisionUnit)
    Sets the value of the property precisionUnit.
    void setValueValidator​(Predicate<Double> valueValidator)
    Sets the value of the property valueValidator.
    javafx.beans.property.ReadOnlyBooleanProperty valueDirtyProperty()
    Boolean property that indicates when the value and the valueQuantity are different because after a precision was applied.
    javafx.beans.property.ObjectProperty<Predicate<Double>> valueValidatorProperty()
    Stores a validator object for the value converted from text entered.

    Methods inherited from class javafx.scene.control.Control

    computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty

    Methods inherited from class javafx.scene.layout.Region

    backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty

    Methods inherited from class javafx.scene.Parent

    getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds

    Methods inherited from class javafx.scene.Node

    accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Property Details

  • Constructor Details

    • QuantityInputField

      public QuantityInputField()
      Instances a new input field with no available units, null value and no precision.
  • Method Details

    • createDefaultSkin

      protected javafx.scene.control.Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class javafx.scene.control.Control
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class javafx.scene.layout.Region
    • restoreValueProperty

      public final void restoreValueProperty()
      Applies the QuantityInputControl.valueQuantityProperty() to the QuantityInputControl.valueProperty() simulating a restore operation. This method not only cleans the value but also cleans the valueDirtyProperty().
    • precisionProperty

      public final javafx.beans.property.ObjectProperty<Double> precisionProperty()
      Integer used to truncate the value entered by the user and calculate the quantity. Default precision is '1' which means no truncation. Bellow some examples:
      • Value=340
      • Unit=Metre
      • Precision=100
      • ValueQuantity=300 Metre
      See Also:
      getPrecision(), setPrecision(Double)
    • getPrecision

      public final Double getPrecision()
      Gets the value of the property precision.
      Property description:
      Integer used to truncate the value entered by the user and calculate the quantity. Default precision is '1' which means no truncation. Bellow some examples:
      • Value=340
      • Unit=Metre
      • Precision=100
      • ValueQuantity=300 Metre
    • setPrecision

      public final void setPrecision​(Double precision)
      Sets the value of the property precision.
      Property description:
      Integer used to truncate the value entered by the user and calculate the quantity. Default precision is '1' which means no truncation. Bellow some examples:
      • Value=340
      • Unit=Metre
      • Precision=100
      • ValueQuantity=300 Metre
    • precisionUnitProperty

      public final javafx.beans.property.ObjectProperty<javax.measure.Unit<Q>> precisionUnitProperty()
      Represents the system base unit, which is the default one for the control. If the unit selected is different to the base unit, the control will indicate visually (colored) that ambiguity. If no base unit is set, not color effect will be applied in the skin.
      See Also:
      getPrecisionUnit(), setPrecisionUnit(Unit)
    • getPrecisionUnit

      public final javax.measure.Unit<Q> getPrecisionUnit()
      Gets the value of the property precisionUnit.
      Property description:
      Represents the system base unit, which is the default one for the control. If the unit selected is different to the base unit, the control will indicate visually (colored) that ambiguity. If no base unit is set, not color effect will be applied in the skin.
    • setPrecisionUnit

      public final void setPrecisionUnit​(javax.measure.Unit<Q> precisionUnit)
      Sets the value of the property precisionUnit.
      Property description:
      Represents the system base unit, which is the default one for the control. If the unit selected is different to the base unit, the control will indicate visually (colored) that ambiguity. If no base unit is set, not color effect will be applied in the skin.
    • precisionQuantityProperty

      public final javafx.beans.property.ReadOnlyObjectProperty<javax.measure.Quantity<Q>> precisionQuantityProperty()
      Represents the precision as combination of precisionProperty() ()} and precisionUnitProperty(). This value is calculated automatically by the control. It is refreshed every time the precision or the precision unit change.
      See Also:
      getPrecisionQuantity()
    • getPrecisionQuantity

      public final javax.measure.Quantity<Q> getPrecisionQuantity()
      Gets the value of the property precisionQuantity.
      Property description:
      Represents the precision as combination of precisionProperty() ()} and precisionUnitProperty(). This value is calculated automatically by the control. It is refreshed every time the precision or the precision unit change.
    • valueDirtyProperty

      public final javafx.beans.property.ReadOnlyBooleanProperty valueDirtyProperty()
      Boolean property that indicates when the value and the valueQuantity are different because after a precision was applied.
      See Also:
      isValueDirty()
    • isValueDirty

      public final boolean isValueDirty()
      Gets the value of the property valueDirty.
      Property description:
      Boolean property that indicates when the value and the valueQuantity are different because after a precision was applied.
    • allowNegativesProperty

      public final javafx.beans.property.BooleanProperty allowNegativesProperty()
      Boolean property that tells the control to allow introducing a negative quantity.
      See Also:
      isAllowNegatives(), setAllowNegatives(boolean)
    • isAllowNegatives

      public final boolean isAllowNegatives()
      Gets the value of the property allowNegatives.
      Property description:
      Boolean property that tells the control to allow introducing a negative quantity.
    • setAllowNegatives

      public final void setAllowNegatives​(boolean allowNegatives)
      Sets the value of the property allowNegatives.
      Property description:
      Boolean property that tells the control to allow introducing a negative quantity.
    • minimumValueProperty

      public final javafx.beans.property.ObjectProperty<Double> minimumValueProperty()
      The minimum value that can be entered in this field. If this property is set, once the user enters a number lower than this minimum the field becomes invalid and the QuantityInputControl.valueProperty() is set to null.
      See Also:
      getMinimumValue(), setMinimumValue(Double)
    • getMinimumValue

      public final Double getMinimumValue()
      Gets the value of the property minimumValue.
      Property description:
      The minimum value that can be entered in this field. If this property is set, once the user enters a number lower than this minimum the field becomes invalid and the QuantityInputControl.valueProperty() is set to null.
    • setMinimumValue

      public final void setMinimumValue​(Double minimumValue)
      Sets the value of the property minimumValue.
      Property description:
      The minimum value that can be entered in this field. If this property is set, once the user enters a number lower than this minimum the field becomes invalid and the QuantityInputControl.valueProperty() is set to null.
    • maximumValueProperty

      public final javafx.beans.property.ObjectProperty<Double> maximumValueProperty()
      The maximum value that can be entered in this field. If this property is set, once the user enters a number greater than this minimum the field becomes invalid and the QuantityInputControl.valueProperty() is set to null.
      See Also:
      getMaximumValue(), setMaximumValue(Double)
    • getMaximumValue

      public final Double getMaximumValue()
      Gets the value of the property maximumValue.
      Property description:
      The maximum value that can be entered in this field. If this property is set, once the user enters a number greater than this minimum the field becomes invalid and the QuantityInputControl.valueProperty() is set to null.
    • setMaximumValue

      public final void setMaximumValue​(Double maximumValue)
      Sets the value of the property maximumValue.
      Property description:
      The maximum value that can be entered in this field. If this property is set, once the user enters a number greater than this minimum the field becomes invalid and the QuantityInputControl.valueProperty() is set to null.
    • invalidProperty

      public final javafx.beans.property.ReadOnlyBooleanProperty invalidProperty()
      Property that indicates when the value entered violates restrictions of minimum and maximum values.
      See Also:
      isInvalid()
    • isInvalid

      public final boolean isInvalid()
      Gets the value of the property invalid.
      Property description:
      Property that indicates when the value entered violates restrictions of minimum and maximum values.
    • valueValidatorProperty

      public final javafx.beans.property.ObjectProperty<Predicate<Double>> valueValidatorProperty()
      Stores a validator object for the value converted from text entered. If the value entered is not valid, a pseudo class is added to the field, called ":invalid". This can be used for styling the field to indicate invalid inputs.
      See Also:
      getValueValidator(), setValueValidator(Predicate)
    • getValueValidator

      public final Predicate<Double> getValueValidator()
      Gets the value of the property valueValidator.
      Property description:
      Stores a validator object for the value converted from text entered. If the value entered is not valid, a pseudo class is added to the field, called ":invalid". This can be used for styling the field to indicate invalid inputs.
    • setValueValidator

      public final void setValueValidator​(Predicate<Double> valueValidator)
      Sets the value of the property valueValidator.
      Property description:
      Stores a validator object for the value converted from text entered. If the value entered is not valid, a pseudo class is added to the field, called ":invalid". This can be used for styling the field to indicate invalid inputs.
    • autoFixValueProperty

      public final javafx.beans.property.BooleanProperty autoFixValueProperty()
      Boolean property used to automatically convert the QuantityInputControl.valueProperty() when the QuantityInputControl.unitProperty() is changed.
      See Also:
      isAutoFixValue(), setAutoFixValue(boolean)
    • isAutoFixValue

      public final boolean isAutoFixValue()
      Gets the value of the property autoFixValue.
      Property description:
      Boolean property used to automatically convert the QuantityInputControl.valueProperty() when the QuantityInputControl.unitProperty() is changed.
    • setAutoFixValue

      public final void setAutoFixValue​(boolean autoFixValue)
      Sets the value of the property autoFixValue.
      Property description:
      Boolean property used to automatically convert the QuantityInputControl.valueProperty() when the QuantityInputControl.unitProperty() is changed.