- All Implemented Interfaces:
Styleable,EventTarget,Skinnable
Node).
This control is quite complex and has a lot of features. A lens (part of the skin), controlled/positioned by the mouse,
is responsible for zooming a portion of the content by the specified zoomProperty().
The mouse wheel controls the zoomProperty() by incrementing/decrementing it by the specified amount, zoomIncrementProperty().
The zoom level can be constrained between a min and max by setting minZoomProperty() and maxZoomProperty().
You can also position the lens manually by setting the positionProperty().
The magnifierViewProperty() specifies the portion of the content that is currently zoomed, it is a bound property,
managed by the skin, any attempt to set an Image will fail with an exception.
MFXMagnifierPane also includes a color picker tool. The lens has a custom cursor (that can also be hidden) that
tells the user which pixel is currently selected. By calling updatePickedColor() the tool will read the selected pixel's color.
The color picker tool also shows a label for the picked color (can also be hidden), the color is converted to a String using a function specified
by the user, by default uses ColorUtils.rgb(Color).
This mechanism allows you to customize the way the picker works. For example if you want the color picker to update the color
in real-time (thus also update the picked color label in real-time) you could do something like:
MFXMagnifierPane mp = new MFXMagnifierPane(content);
mp.magnifierViewProperty().addListener(invalidated -> mp.updatePickedColor());
Or, if you want to update it only when a mouse event occurs you could do something like:
MFXMagnifierPane mp = new MFXMagnifierPane(content);
mp.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> {
if (event.getButton() == MouseButton.PRIMARY) {
mp.updatePickedColor();
}
});
-
Property Summary
PropertiesTypePropertyDescriptionSpecifies theStringConverterused to convert aColorto a String.Specifies the magnifier's content.Specifies whether to show or hide the custom cursor.Specifies the size of the lens.Specifies the current zoomed portion of the content.Specifies the maximum zoom level allowed.Specifies the minimum zoom level allowed.Specifies the picked color.Specifies the position of the color picker tool.Specifies the gap between the lens and the color picker tool.Specifies the position of the lens.Specifies whether to show a label that indicates the current zoom level.Specifies the zoom increment/decrement when using the mouse wheel.Specifies the current zoom level of the lens.Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltipProperties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties 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_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSpecifies theStringConverterused to convert aColorto a String.Specifies the magnifier's content.protected Skin<?>static List<CssMetaData<? extends Styleable,?>> Gets the value of the property colorConverter.Gets the value of the property content.protected List<CssMetaData<? extends Styleable,?>> doubleGets the value of the property hideZoomLabelAfter.doubleGets the value of the property lensSize.Gets the value of the property magnifierView.doubleGets the value of the property maxZoom.doubleGets the value of the property minZoom.Gets the value of the property pickedColor.Gets the value of the property pickerPos.doubleGets the value of the property pickerSpacing.Gets the value of the property position.doublegetZoom()Gets the value of the property zoom.doubleGets the value of the property zoomIncrement.Specifies whether to show or hide the custom cursor.booleanGets the value of the property hideCursor.booleanGets the value of the property showZoomLabel.Specifies the size of the lens.Specifies the current zoomed portion of the content.Specifies the maximum zoom level allowed.Specifies the minimum zoom level allowed.Specifies the picked color.Specifies the position of the color picker tool.Specifies the gap between the lens and the color picker tool.Specifies the position of the lens.voidsetColorConverter(StringConverter<Color> colorConverter) Sets the value of the property colorConverter.voidsetContent(Node content) Sets the value of the property content.voidsetHideCursor(boolean hideCursor) Sets the value of the property hideCursor.voidsetHideZoomLabelAfter(double hideZoomLabelAfter) Sets the value of the property hideZoomLabelAfter.voidsetLensSize(double lensSize) Sets the value of the property lensSize.voidsetMaxZoom(double maxZoom) Sets the value of the property maxZoom.voidsetMinZoom(double minZoom) Sets the value of the property minZoom.voidsetPickerPos(VPos pickerPos) Sets the value of the property pickerPos.voidsetPickerSpacing(double pickerSpacing) Sets the value of the property pickerSpacing.voidsetPosition(PositionBean position) Sets the value of the property position.voidsetShowZoomLabel(boolean showZoomLabel) Sets the value of the property showZoomLabel.voidsetZoom(double zoom) Sets the value of the property zoom.voidsetZoomIncrement(double zoomIncrement) Sets the value of the property zoomIncrement.Specifies whether to show a label that indicates the current zoom level.voidUpdates thepickedColorProperty().Specifies the zoom increment/decrement when using the mouse wheel.Specifies the current zoom level of the lens.Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getContextMenu, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipPropertyMethods 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, widthPropertyMethods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods 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, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
lensSize
Specifies the size of the lens.The default lens by default is a square, but then it is clipped to be a circle. You can think of this property as the diameter of the circle.
- See Also:
-
zoom
Specifies the current zoom level of the lens.- See Also:
-
zoomIncrement
Specifies the zoom increment/decrement when using the mouse wheel.- See Also:
-
minZoom
Specifies the minimum zoom level allowed.- See Also:
-
maxZoom
Specifies the maximum zoom level allowed.- See Also:
-
pickerPos
Specifies the position of the color picker tool.Only two positions are allowed, above the lens (TOP) or below the lens (BOTTOM).
- See Also:
-
pickerSpacing
Specifies the gap between the lens and the color picker tool.- See Also:
-
hideCursor
Specifies whether to show or hide the custom cursor.Node that to use the custom cursor by default the magnifier pane's cursor is set to
Cursor.NONE.- See Also:
-
showZoomLabel
Specifies whether to show a label that indicates the current zoom level.The label is shown only when the
zoomProperty()changes, and is hidden afterhideZoomLabelAfterProperty().- See Also:
-
hideZoomLabelAfter
-
content
Specifies the magnifier's content.- See Also:
-
position
Specifies the position of the lens.- See Also:
-
magnifierView
Specifies the current zoomed portion of the content.- See Also:
-
pickedColor
Specifies the picked color.Not updated automatically, you must call
updatePickedColor(), see class documentation for examples.- See Also:
-
colorConverter
Specifies theStringConverterused to convert aColorto a String.
-
-
Constructor Details
-
MFXMagnifierPane
-
-
Method Details
-
updatePickedColor
public void updatePickedColor()Updates thepickedColorProperty().Attempts to read the selected pixel's color by getting the current zoomed portion of the content (if null exits), then uses the image's
PixelReaderto read the color. -
createDefaultSkin
- Overrides:
createDefaultSkinin classControl
-
getUserAgentStylesheet
- Overrides:
getUserAgentStylesheetin classRegion
-
getLensSize
public double getLensSize()Gets the value of the property lensSize.- Property description:
- Specifies the size of the lens.
The default lens by default is a square, but then it is clipped to be a circle. You can think of this property as the diameter of the circle.
-
lensSizeProperty
Specifies the size of the lens.The default lens by default is a square, but then it is clipped to be a circle. You can think of this property as the diameter of the circle.
- See Also:
-
setLensSize
public void setLensSize(double lensSize) Sets the value of the property lensSize.- Property description:
- Specifies the size of the lens.
The default lens by default is a square, but then it is clipped to be a circle. You can think of this property as the diameter of the circle.
-
getZoom
public double getZoom()Gets the value of the property zoom.- Property description:
- Specifies the current zoom level of the lens.
-
zoomProperty
Specifies the current zoom level of the lens.- See Also:
-
setZoom
public void setZoom(double zoom) Sets the value of the property zoom.- Property description:
- Specifies the current zoom level of the lens.
-
getZoomIncrement
public double getZoomIncrement()Gets the value of the property zoomIncrement.- Property description:
- Specifies the zoom increment/decrement when using the mouse wheel.
-
zoomIncrementProperty
Specifies the zoom increment/decrement when using the mouse wheel.- See Also:
-
setZoomIncrement
public void setZoomIncrement(double zoomIncrement) Sets the value of the property zoomIncrement.- Property description:
- Specifies the zoom increment/decrement when using the mouse wheel.
-
getMinZoom
public double getMinZoom()Gets the value of the property minZoom.- Property description:
- Specifies the minimum zoom level allowed.
-
minZoomProperty
Specifies the minimum zoom level allowed.- See Also:
-
setMinZoom
public void setMinZoom(double minZoom) Sets the value of the property minZoom.- Property description:
- Specifies the minimum zoom level allowed.
-
getMaxZoom
public double getMaxZoom()Gets the value of the property maxZoom.- Property description:
- Specifies the maximum zoom level allowed.
-
maxZoomProperty
Specifies the maximum zoom level allowed.- See Also:
-
setMaxZoom
public void setMaxZoom(double maxZoom) Sets the value of the property maxZoom.- Property description:
- Specifies the maximum zoom level allowed.
-
getPickerPos
Gets the value of the property pickerPos.- Property description:
- Specifies the position of the color picker tool.
Only two positions are allowed, above the lens (TOP) or below the lens (BOTTOM).
-
pickerPosProperty
Specifies the position of the color picker tool.Only two positions are allowed, above the lens (TOP) or below the lens (BOTTOM).
- See Also:
-
setPickerPos
Sets the value of the property pickerPos.- Property description:
- Specifies the position of the color picker tool.
Only two positions are allowed, above the lens (TOP) or below the lens (BOTTOM).
-
getPickerSpacing
public double getPickerSpacing()Gets the value of the property pickerSpacing.- Property description:
- Specifies the gap between the lens and the color picker tool.
-
pickerSpacingProperty
Specifies the gap between the lens and the color picker tool.- See Also:
-
setPickerSpacing
public void setPickerSpacing(double pickerSpacing) Sets the value of the property pickerSpacing.- Property description:
- Specifies the gap between the lens and the color picker tool.
-
isHideCursor
public boolean isHideCursor()Gets the value of the property hideCursor.- Property description:
- Specifies whether to show or hide the custom cursor.
Node that to use the custom cursor by default the magnifier pane's cursor is set to
Cursor.NONE.
-
hideCursorProperty
Specifies whether to show or hide the custom cursor.Node that to use the custom cursor by default the magnifier pane's cursor is set to
Cursor.NONE.- See Also:
-
setHideCursor
public void setHideCursor(boolean hideCursor) Sets the value of the property hideCursor.- Property description:
- Specifies whether to show or hide the custom cursor.
Node that to use the custom cursor by default the magnifier pane's cursor is set to
Cursor.NONE.
-
isShowZoomLabel
public boolean isShowZoomLabel()Gets the value of the property showZoomLabel.- Property description:
- Specifies whether to show a label that indicates the current zoom level.
The label is shown only when the
zoomProperty()changes, and is hidden afterhideZoomLabelAfterProperty().
-
showZoomLabelProperty
Specifies whether to show a label that indicates the current zoom level.The label is shown only when the
zoomProperty()changes, and is hidden afterhideZoomLabelAfterProperty().- See Also:
-
setShowZoomLabel
public void setShowZoomLabel(boolean showZoomLabel) Sets the value of the property showZoomLabel.- Property description:
- Specifies whether to show a label that indicates the current zoom level.
The label is shown only when the
zoomProperty()changes, and is hidden afterhideZoomLabelAfterProperty().
-
getHideZoomLabelAfter
public double getHideZoomLabelAfter()Gets the value of the property hideZoomLabelAfter.- Property description:
-
hideZoomLabelAfterProperty
-
setHideZoomLabelAfter
public void setHideZoomLabelAfter(double hideZoomLabelAfter) Sets the value of the property hideZoomLabelAfter.- Property description:
-
getClassCssMetaData
-
getControlCssMetaData
- Overrides:
getControlCssMetaDatain classControl
-
getContent
Gets the value of the property content.- Property description:
- Specifies the magnifier's content.
-
contentProperty
Specifies the magnifier's content.- See Also:
-
setContent
Sets the value of the property content.- Property description:
- Specifies the magnifier's content.
-
getPosition
Gets the value of the property position.- Property description:
- Specifies the position of the lens.
-
positionProperty
Specifies the position of the lens.- See Also:
-
setPosition
Sets the value of the property position.- Property description:
- Specifies the position of the lens.
-
getMagnifierView
Gets the value of the property magnifierView.- Property description:
- Specifies the current zoomed portion of the content.
-
magnifierViewProperty
Specifies the current zoomed portion of the content.- See Also:
-
getPickedColor
Gets the value of the property pickedColor.- Property description:
- Specifies the picked color.
Not updated automatically, you must call
updatePickedColor(), see class documentation for examples.
-
pickedColorProperty
Specifies the picked color.Not updated automatically, you must call
updatePickedColor(), see class documentation for examples.- See Also:
-
getColorConverter
Gets the value of the property colorConverter.- Property description:
- Specifies the
StringConverterused to convert aColorto a String.
-
colorConverterProperty
Specifies theStringConverterused to convert aColorto a String. -
setColorConverter
Sets the value of the property colorConverter.- Property description:
- Specifies the
StringConverterused to convert aColorto a String.
-