Package javafx.scene.control
Class ToggleButton
java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.control.Control
javafx.scene.control.Labeled
javafx.scene.control.ButtonBase
javafx.scene.control.ToggleButton
- All Implemented Interfaces:
LayoutMeasurable,LayoutMeasurableMixin,HasAlignmentProperty,HasBackgroundProperty,HasBlendModeProperty,HasBorderProperty,HasClipProperty,HasEffectProperty,HasFontProperty,HasGraphicProperty,HasHeightProperty,HasImageUrlProperty,HasLayoutXProperty,HasLayoutYProperty,HasManagedProperty,HasMaxHeightProperty,HasMaxWidthProperty,HasMinHeightProperty,HasMinWidthProperty,HasMouseTransparentProperty,HasOnMouseClickedProperty,HasOpacityProperty,HasPaddingProperty,HasParentProperty,HasPrefHeightProperty,HasPrefWidthProperty,HasSnapToPixelProperty,HasTextAlignmentProperty,HasTextFillProperty,HasTextProperty,HasVisibleProperty,HasWidthProperty,Styleable,EventTarget,Skinnable,Toggle,INode,PreferenceResizableNode
- Direct Known Subclasses:
RadioButton
- Author:
- Bruno Salmon
-
Property Summary
PropertiesTypePropertyDescriptionfinal BooleanPropertyIndicates whether this toggle button is selected.final ObjectProperty<ToggleGroup>TheToggleGroupto which thisToggleButtonbelongs.Properties inherited from class javafx.scene.control.ButtonBase
armed, onActionProperties inherited from class javafx.scene.control.Labeled
alignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, imageUrl, labelPadding, lineSpacing, textAlignment, textFill, textOverrun, text, wrapTextProperties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltipProperties inherited from class javafx.scene.layout.Region
background, border, height, insets, maxHeight, maxWidth, minHeight, minWidth, padding, prefHeight, prefWidth, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties inherited from class javafx.scene.Node
blendMode, cacheHint, cache, clip, cursor, disabled, disable, effect, eventDispatcher, focused, focusTraversable, hover, id, layoutBounds, layoutX, layoutY, managed, mouseTransparent, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onScroll, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, opacity, parent, pressed, rotate, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, visibleProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBlendModeProperty
blendModeProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasClipProperty
clipProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasEffectProperty
effectProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutXProperty
layoutXProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutYProperty
layoutYProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasManagedProperty
managedProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMouseTransparentProperty
mouseTransparentProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOnMouseClickedProperty
onMouseClickedProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOpacityProperty
opacityProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasParentProperty
parentProperties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasVisibleProperty
visible -
Field Summary
Fields inherited from interface javafx.scene.INode
BASELINE_OFFSET_SAME_AS_HEIGHTFields inherited from interface javafx.scene.layout.PreferenceResizableNode
USE_COMPUTED_SIZE, USE_PREF_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionCreates a toggle button with an empty string for its label.ToggleButton(String text) Creates a toggle button with the specified text as its label.ToggleButton(String text, Node graphic) Creates a toggle button with the specified text and icon for its label. -
Method Summary
Modifier and TypeMethodDescriptionprotected Skin<?>Create a new instance of the default skin for this control.voidfire()Invoked when a user gesture indicates that an event for thisButtonBaseshould occur.final ToggleGroupGets the value of thetoggleGroupproperty.protected voidfinal booleanGets the value of theselectedproperty.final BooleanPropertyIndicates whether this toggle button is selected.final voidsetSelected(boolean value) Sets the value of theselectedproperty.final voidsetToggleGroup(ToggleGroup value) Sets the value of thetoggleGroupproperty.final ObjectProperty<ToggleGroup>TheToggleGroupto which thisToggleButtonbelongs.Methods inherited from class javafx.scene.control.ButtonBase
arm, armedProperty, disarm, getOnAction, isArmed, onActionProperty, setOnActionMethods inherited from class javafx.scene.control.Labeled
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, getContentBias, getContentDisplay, getEllipsisString, getGraphicTextGap, getLabelPadding, getLineSpacing, getTextOverrun, graphicProperty, graphicTextGapProperty, imageUrlProperty, isWrapText, labelPaddingProperty, lineSpacingProperty, setContentDisplay, setEllipsisString, setGraphicTextGap, setLineSpacing, setScene, setTextOverrun, setWrapText, textAlignmentProperty, textFillProperty, textOverrunProperty, textProperty, wrapTextPropertyMethods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getSkin, getTooltip, layoutChildren, setContextMenu, setSkin, setTooltip, shouldUseLayoutMeasurable, skinProperty, tooltipPropertyMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, boundedSize, getInsets, heightProperty, impl_computeGeomBounds, impl_computeLayoutBounds, impl_maxHeight, impl_maxWidth, impl_minHeight, impl_minWidth, impl_prefHeight, impl_prefWidth, insetsProperty, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, paddingProperty, positionInArea, positionInArea, prefHeightProperty, prefWidthProperty, resize, setMaxSize, setMinSize, setPrefSize, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthPropertyMethods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, isNeedsLayout, layout, needsLayoutProperty, requestLayout, requestParentLayout, setLayoutFlag, setNeedsLayout, setSceneRootMethods inherited from class javafx.scene.Node
addEventFilter, addEventHandler, autosize, blendModeProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, createLayoutMeasurable, cursorProperty, disabledProperty, disableProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAllNodeTransforms, getBoundsInLocal, getCacheHint, getCursor, getEventDispatcher, getId, getLayoutMeasurable, getNodePeer, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseDragged, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnScroll, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOrCreateAndBindNodePeer, getProperties, getRotate, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleClass, getTransforms, getTranslateX, getTranslateY, getUserData, hasProperties, hoverProperty, idProperty, impl_getLayoutBounds, impl_isTreeVisible, impl_traverse, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isPressed, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToScene, localToScene, localToScreen, localToScreen, localToScreen, localToScreen, managedProperty, mouseTransparentProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDraggedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onNodePeerReady, onPeerSizeChanged, onScrollProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, opacityProperty, parentProperty, parentToLocal, pressedProperty, removeEventFilter, removeEventHandler, requestFocus, requestPeerFocus, rotateProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, setCache, setCacheHint, setCursor, setDisable, setDisabled, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setNodePeer, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseDragged, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnScroll, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setPressed, setRotate, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setUserData, snapshot, startDragAndDrop, styleProperty, toBack, toFront, translateXProperty, translateYProperty, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasAlignmentProperty
getAlignment, setAlignmentMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBackgroundProperty
getBackground, setBackgroundMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBlendModeProperty
blendModeProperty, getBlendMode, setBlendModeMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBorderProperty
getBorder, setBorderMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasClipProperty
clipProperty, getClip, setClipMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasEffectProperty
effectProperty, getEffect, setEffectMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasFontProperty
getFont, setFontMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasGraphicProperty
getGraphic, setGraphicMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasHeightProperty
getHeight, setHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasImageUrlProperty
getImageUrl, setImageUrlMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutXProperty
getLayoutX, layoutXProperty, setLayoutXMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutYProperty
getLayoutY, layoutYProperty, setLayoutYMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasManagedProperty
isManaged, managedProperty, setManagedMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMaxHeightProperty
getMaxHeight, setMaxHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMaxWidthProperty
getMaxWidth, setMaxWidthMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMinHeightProperty
getMinHeight, setMinHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMinWidthProperty
getMinWidth, setMinWidthMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMouseTransparentProperty
isMouseTransparent, mouseTransparentProperty, setMouseTransparentMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOnMouseClickedProperty
getOnMouseClicked, onMouseClickedProperty, setOnMouseClickedMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOpacityProperty
getOpacity, opacityProperty, setOpacityMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPaddingProperty
getPadding, setPaddingMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasParentProperty
getParent, parentProperty, setParentMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPrefHeightProperty
getPrefHeight, setPrefHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPrefWidthProperty
getPrefWidth, setPrefWidthMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasSnapToPixelProperty
isSnapToPixel, setSnapToPixelMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextAlignmentProperty
getTextAlignment, setTextAlignmentMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextFillProperty
getTextFill, setTextFillMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextProperty
getText, setTextMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasVisibleProperty
isVisible, setVisible, visiblePropertyMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasWidthProperty
getWidth, setWidthMethods inherited from interface javafx.scene.INode
autosize, getAllNodeTransforms, getNodePeer, getOrCreateAndBindNodePeer, getProperties, getScene, getTransforms, hasProperties, relocate, resizeRelocateMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.emul_coupling.LayoutMeasurableMixin
clearCache, getLayoutBounds, getLayoutMeasurable, maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidthMethods inherited from interface javafx.scene.layout.PreferenceResizableNode
isResizableMethods inherited from interface javafx.scene.control.Toggle
getProperties, getUserData, setUserData
-
Property Details
-
selected
Indicates whether this toggle button is selected. This can be manipulated programmatically.- Specified by:
selectedPropertyin interfaceToggle- Returns:
- the
selectedproperty - See Also:
-
toggleGroup
TheToggleGroupto which thisToggleButtonbelongs. AToggleButtoncan only be in one group at any one time. If the group is changed, then the button is removed from the old group prior to being added to the new group.- Specified by:
toggleGroupPropertyin interfaceToggle- Returns:
- the
toggleGroupproperty - See Also:
-
-
Constructor Details
-
ToggleButton
public ToggleButton()Creates a toggle button with an empty string for its label. -
ToggleButton
Creates a toggle button with the specified text as its label.- Parameters:
text- A text string for its label.
-
ToggleButton
Creates a toggle button with the specified text and icon for its label.- Parameters:
text- A text string for its label.graphic- the icon for its label.
-
-
Method Details
-
initialize
protected void initialize() -
setSelected
public final void setSelected(boolean value) Sets the value of theselectedproperty.- Specified by:
setSelectedin interfaceToggle- Property description:
- Indicates whether this toggle button is selected. This can be manipulated programmatically.
- Parameters:
value- the value for theselectedproperty- See Also:
-
isSelected
public final boolean isSelected()Gets the value of theselectedproperty.- Specified by:
isSelectedin interfaceToggle- Property description:
- Indicates whether this toggle button is selected. This can be manipulated programmatically.
- Returns:
- the value of the
selectedproperty - See Also:
-
selectedProperty
Indicates whether this toggle button is selected. This can be manipulated programmatically.- Specified by:
selectedPropertyin interfaceToggle- Returns:
- the
selectedproperty - See Also:
-
setToggleGroup
Sets the value of thetoggleGroupproperty.- Specified by:
setToggleGroupin interfaceToggle- Property description:
- The
ToggleGroupto which thisToggleButtonbelongs. AToggleButtoncan only be in one group at any one time. If the group is changed, then the button is removed from the old group prior to being added to the new group. - Parameters:
value- the value for thetoggleGroupproperty- See Also:
-
getToggleGroup
Gets the value of thetoggleGroupproperty.- Specified by:
getToggleGroupin interfaceToggle- Property description:
- The
ToggleGroupto which thisToggleButtonbelongs. AToggleButtoncan only be in one group at any one time. If the group is changed, then the button is removed from the old group prior to being added to the new group. - Returns:
- the value of the
toggleGroupproperty - See Also:
-
toggleGroupProperty
TheToggleGroupto which thisToggleButtonbelongs. AToggleButtoncan only be in one group at any one time. If the group is changed, then the button is removed from the old group prior to being added to the new group.- Specified by:
toggleGroupPropertyin interfaceToggle- Returns:
- the
toggleGroupproperty - See Also:
-
fire
public void fire()Invoked when a user gesture indicates that an event for thisButtonBaseshould occur.If invoked, this method will be executed regardless of the status of
ButtonBase.arm().- Specified by:
firein classButtonBase
-
createDefaultSkin
Description copied from class:ControlCreate a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS-fx-skinor set explicitly in a sub-class withsetSkin(...).- Overrides:
createDefaultSkinin classControl- Returns:
- new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
-