- All Implemented Interfaces:
MFXLabeled,Styleable,EventTarget,Skinnable,Toggle
Extends Labeled and implements Toggle and MFXLabeled, its CSS selector is "-mfx-toggle-button",
includes a RippleGenerator(in the Skin) to generate ripple effect when selected/unselected.
- contentDispositionProperty(): to control the toggle position
- gapProperty(): to control the gap between the toggle and the text
- lengthProperty(): to control the toggle's line width
- radiusProperty(): to control the toggle's circle radius
- textExpandProperty(): to control the text size and the checkbox layout (see documentation)
-
Property Summary
PropertiesTypePropertyDescriptionSpecifies how the control is positioned relative to its text.Specifies the spacing between the control and its text.Specifies the length of the toggle button's line.Specifies the action to perform when the toggle button is selected/unselected.Specifies the radius of the toggle button's circle.When setting a specific size for the control (by using setPrefSize for example, and this is true for SceneBuilder too), this flag will tell the control's label to take all the space available.Properties inherited from class javafx.scene.control.Labeled
alignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, labelPadding, lineSpacing, mnemonicParsing, textAlignment, textFill, textOverrun, text, underline, wrapTextProperties 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
FieldsFields 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 how the control is positioned relative to its text.protected Skin<?>voidfire()Changes the state of the toggle button if not disabled.Specifies the spacing between the control and its text.Gets the value of the property contentDisposition.List<CssMetaData<? extends Styleable,?>> static List<CssMetaData<? extends Styleable,?>> doublegetGap()Gets the value of the property gap.doubleGets the value of the property length.Gets the value of the property onAction.doubleGets the value of the property radius.Gets the value of the property toggleGroup.booleanGets the value of the property selected.booleanGets the value of the property textExpand.Specifies the length of the toggle button's line.Specifies the action to perform when the toggle button is selected/unselected.Specifies the radius of the toggle button's circle.protected voidvoidCombinessetMainColor(Color)andsetSecondaryColor(Color)into one method.voidsetContentDisposition(ContentDisplay contentDisposition) Sets the value of the property contentDisposition.voidsetGap(double gap) Sets the value of the property gap.voidsetLength(double length) Sets the value of the property length.voidsetMainColor(Color color) Sets the colors of the toggle button when selected.voidsetOnAction(EventHandler<ActionEvent> onAction) Sets the value of the property onAction.voidsetRadius(double radius) Sets the value of the property radius.voidsetSecondaryColor(Color color) Sets the colors of the toggle button when not selected.voidsetSelected(boolean selected) Sets the value of the property selected.voidsetTextExpand(boolean textExpand) Sets the value of the property textExpand.voidsetToggleGroup(ToggleGroup toggleGroup) Sets the value of the property toggleGroup.When setting a specific size for the control (by using setPrefSize for example, and this is true for SceneBuilder too), this flag will tell the control's label to take all the space available.Methods inherited from class javafx.scene.control.Labeled
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, getAlignment, getClassCssMetaData, getContentBias, getContentDisplay, getEllipsisString, getFont, getGraphic, getGraphicTextGap, getInitialAlignment, getLabelPadding, getLineSpacing, getText, getTextAlignment, getTextFill, getTextOverrun, graphicProperty, graphicTextGapProperty, isMnemonicParsing, isUnderline, isWrapText, labelPaddingProperty, lineSpacingProperty, mnemonicParsingProperty, setAlignment, setContentDisplay, setEllipsisString, setFont, setGraphic, setGraphicTextGap, setLineSpacing, setMnemonicParsing, setText, setTextAlignment, setTextFill, setTextOverrun, setUnderline, setWrapText, textAlignmentProperty, textFillProperty, textOverrunProperty, textProperty, toString, underlineProperty, wrapTextPropertyMethods 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, 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, 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
getStyleableNodeMethods inherited from interface javafx.scene.control.Toggle
getProperties, getUserData, setUserData
-
Property Details
-
toggleGroup
- Specified by:
toggleGroupPropertyin interfaceToggle- See Also:
-
selected
- Specified by:
selectedPropertyin interfaceToggle- See Also:
-
onAction
Specifies the action to perform when the toggle button is selected/unselected.- See Also:
-
contentDisposition
- Specified by:
contentDispositionPropertyin interfaceMFXLabeled- See Also:
-
gap
- Specified by:
gapPropertyin interfaceMFXLabeled- See Also:
-
length
Specifies the length of the toggle button's line.- See Also:
-
radius
Specifies the radius of the toggle button's circle.- See Also:
-
textExpand
- Specified by:
textExpandPropertyin interfaceMFXLabeled- See Also:
-
-
Field Details
-
SELECTED_PSEUDO_CLASS
-
-
Constructor Details
-
MFXToggleButton
public MFXToggleButton() -
MFXToggleButton
-
MFXToggleButton
-
-
Method Details
-
setBehavior
protected void setBehavior() -
fire
public void fire()Changes the state of the toggle button if not disabled. -
getToggleGroup
Gets the value of the property toggleGroup.- Specified by:
getToggleGroupin interfaceToggle- Property description:
-
toggleGroupProperty
- Specified by:
toggleGroupPropertyin interfaceToggle- See Also:
-
setToggleGroup
Sets the value of the property toggleGroup.- Specified by:
setToggleGroupin interfaceToggle- Property description:
-
isSelected
public boolean isSelected()Gets the value of the property selected.- Specified by:
isSelectedin interfaceToggle- Property description:
-
selectedProperty
- Specified by:
selectedPropertyin interfaceToggle- See Also:
-
setSelected
public void setSelected(boolean selected) Sets the value of the property selected.- Specified by:
setSelectedin interfaceToggle- Property description:
-
getOnAction
Gets the value of the property onAction.- Property description:
- Specifies the action to perform when the toggle button is selected/unselected.
-
onActionProperty
Specifies the action to perform when the toggle button is selected/unselected.- See Also:
-
setOnAction
Sets the value of the property onAction.- Property description:
- Specifies the action to perform when the toggle button is selected/unselected.
-
getContentDisposition
Gets the value of the property contentDisposition.- Specified by:
getContentDispositionin interfaceMFXLabeled- Property description:
-
contentDispositionProperty
Description copied from interface:MFXLabeledSpecifies how the control is positioned relative to its text.- Specified by:
contentDispositionPropertyin interfaceMFXLabeled- See Also:
-
setContentDisposition
Sets the value of the property contentDisposition.- Specified by:
setContentDispositionin interfaceMFXLabeled- Property description:
-
getGap
public double getGap()Gets the value of the property gap.- Specified by:
getGapin interfaceMFXLabeled- Property description:
-
gapProperty
Description copied from interface:MFXLabeledSpecifies the spacing between the control and its text.- Specified by:
gapPropertyin interfaceMFXLabeled- See Also:
-
setGap
public void setGap(double gap) Sets the value of the property gap.- Specified by:
setGapin interfaceMFXLabeled- Property description:
-
getLength
public double getLength()Gets the value of the property length.- Property description:
- Specifies the length of the toggle button's line.
-
lengthProperty
Specifies the length of the toggle button's line.- See Also:
-
setLength
public void setLength(double length) Sets the value of the property length.- Property description:
- Specifies the length of the toggle button's line.
-
getRadius
public double getRadius()Gets the value of the property radius.- Property description:
- Specifies the radius of the toggle button's circle.
-
radiusProperty
Specifies the radius of the toggle button's circle.- See Also:
-
setRadius
public void setRadius(double radius) Sets the value of the property radius.- Property description:
- Specifies the radius of the toggle button's circle.
-
isTextExpand
public boolean isTextExpand()Gets the value of the property textExpand.- Specified by:
isTextExpandin interfaceMFXLabeled- Property description:
-
textExpandProperty
Description copied from interface:MFXLabeledWhen setting a specific size for the control (by using setPrefSize for example, and this is true for SceneBuilder too), this flag will tell the control's label to take all the space available.This allows, in combination with the
MFXLabeled.contentDispositionProperty(), to layout the control's content in many interesting ways. When the text is expanded (this property is true) useLabeled.alignmentProperty()to position the text.- Specified by:
textExpandPropertyin interfaceMFXLabeled- See Also:
-
setTextExpand
public void setTextExpand(boolean textExpand) Sets the value of the property textExpand.- Specified by:
setTextExpandin interfaceMFXLabeled- Property description:
-
setMainColor
Sets the colors of the toggle button when selected.The color is set inline by using
Node.setStyle(String), the set CSS value is the "-mfx-main" property. -
setSecondaryColor
Sets the colors of the toggle button when not selected.The color is set inline by using
Node.setStyle(String), the set CSS value is the "-mfx-secondary" property. -
setColors
CombinessetMainColor(Color)andsetSecondaryColor(Color)into one method.If you want to set both colors then you must use this method since multiple calls to
Node.setStyle(String)retain only the last specified style. -
getControlCssMetaDataList
-
createDefaultSkin
- Overrides:
createDefaultSkinin classControl
-
getUserAgentStylesheet
- Overrides:
getUserAgentStylesheetin classRegion
-
getControlCssMetaData
- Overrides:
getControlCssMetaDatain classLabeled
-