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
TypePropertyDescriptionfinal BooleanProperty
Indicates whether this toggle button is selected.final ObjectProperty<ToggleGroup>
TheToggleGroup
to which thisToggleButton
belongs.Properties inherited from class javafx.scene.control.ButtonBase
armed, onAction
Properties inherited from class javafx.scene.control.Labeled
alignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, imageUrl, labelPadding, lineSpacing, textAlignment, textFill, textOverrun, text, wrapText
Properties inherited from class javafx.scene.control.Control
contextMenu, skin
Properties inherited from class javafx.scene.layout.Region
background, border, height, insets, maxHeight, maxWidth, minHeight, minWidth, padding, prefHeight, prefWidth, snapToPixel, width
Properties inherited from class javafx.scene.Parent
needsLayout
Properties 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, visible
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBlendModeProperty
blendMode
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasClipProperty
clip
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasEffectProperty
effect
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutXProperty
layoutX
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutYProperty
layoutY
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasManagedProperty
managed
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMouseTransparentProperty
mouseTransparent
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOnMouseClickedProperty
onMouseClicked
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOpacityProperty
opacity
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasParentProperty
parent
Properties 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_HEIGHT
Fields inherited from interface javafx.scene.layout.PreferenceResizableNode
USE_COMPUTED_SIZE, USE_PREF_SIZE
-
Constructor Summary
ConstructorDescriptionCreates 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.void
fire()
Invoked when a user gesture indicates that an event for thisButtonBase
should occur.final ToggleGroup
Gets the value of thetoggleGroup
property.protected void
final boolean
Gets the value of theselected
property.final BooleanProperty
Indicates whether this toggle button is selected.final void
setSelected
(boolean value) Sets the value of theselected
property.final void
setToggleGroup
(ToggleGroup value) Sets the value of thetoggleGroup
property.final ObjectProperty<ToggleGroup>
TheToggleGroup
to which thisToggleButton
belongs.Methods inherited from class javafx.scene.control.ButtonBase
arm, armedProperty, disarm, getOnAction, isArmed, onActionProperty, setOnAction
Methods 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, wrapTextProperty
Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getSkin, layoutChildren, setContextMenu, setSkin, shouldUseLayoutMeasurable, skinProperty
Methods 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, widthProperty
Methods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, isNeedsLayout, layout, needsLayoutProperty, requestLayout, requestParentLayout, setLayoutFlag, setNeedsLayout, setSceneRoot
Methods 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, visibleProperty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasAlignmentProperty
getAlignment, setAlignment
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBackgroundProperty
getBackground, setBackground
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBlendModeProperty
blendModeProperty, getBlendMode, setBlendMode
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBorderProperty
getBorder, setBorder
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasClipProperty
clipProperty, getClip, setClip
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasEffectProperty
effectProperty, getEffect, setEffect
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasFontProperty
getFont, setFont
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasGraphicProperty
getGraphic, setGraphic
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasHeightProperty
getHeight, setHeight
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasImageUrlProperty
getImageUrl, setImageUrl
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutXProperty
getLayoutX, layoutXProperty, setLayoutX
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutYProperty
getLayoutY, layoutYProperty, setLayoutY
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasManagedProperty
isManaged, managedProperty, setManaged
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMaxHeightProperty
getMaxHeight, setMaxHeight
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMaxWidthProperty
getMaxWidth, setMaxWidth
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMinHeightProperty
getMinHeight, setMinHeight
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMinWidthProperty
getMinWidth, setMinWidth
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMouseTransparentProperty
isMouseTransparent, mouseTransparentProperty, setMouseTransparent
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOnMouseClickedProperty
getOnMouseClicked, onMouseClickedProperty, setOnMouseClicked
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOpacityProperty
getOpacity, opacityProperty, setOpacity
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPaddingProperty
getPadding, setPadding
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasParentProperty
getParent, parentProperty, setParent
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPrefHeightProperty
getPrefHeight, setPrefHeight
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPrefWidthProperty
getPrefWidth, setPrefWidth
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasSnapToPixelProperty
isSnapToPixel, setSnapToPixel
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextAlignmentProperty
getTextAlignment, setTextAlignment
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextFillProperty
getTextFill, setTextFill
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextProperty
getText, setText
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasVisibleProperty
isVisible, setVisible, visibleProperty
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasWidthProperty
getWidth, setWidth
Methods inherited from interface javafx.scene.INode
autosize, getAllNodeTransforms, getNodePeer, getOrCreateAndBindNodePeer, getProperties, getScene, getTransforms, hasProperties, relocate, resizeRelocate
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.emul_coupling.LayoutMeasurableMixin
clearCache, getLayoutBounds, getLayoutMeasurable, maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidth
Methods inherited from interface javafx.scene.layout.PreferenceResizableNode
isResizable
Methods 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:
selectedProperty
in interfaceToggle
- Returns:
- the
selected
property - See Also:
-
toggleGroup
TheToggleGroup
to which thisToggleButton
belongs. AToggleButton
can 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:
toggleGroupProperty
in interfaceToggle
- Returns:
- the
toggleGroup
property - 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 theselected
property.- Specified by:
setSelected
in interfaceToggle
- Property description:
- Indicates whether this toggle button is selected. This can be manipulated programmatically.
- Parameters:
value
- the value for theselected
property- See Also:
-
isSelected
public final boolean isSelected()Gets the value of theselected
property.- Specified by:
isSelected
in interfaceToggle
- Property description:
- Indicates whether this toggle button is selected. This can be manipulated programmatically.
- Returns:
- the value of the
selected
property - See Also:
-
selectedProperty
Indicates whether this toggle button is selected. This can be manipulated programmatically.- Specified by:
selectedProperty
in interfaceToggle
- Returns:
- the
selected
property - See Also:
-
setToggleGroup
Sets the value of thetoggleGroup
property.- Specified by:
setToggleGroup
in interfaceToggle
- Property description:
- The
ToggleGroup
to which thisToggleButton
belongs. AToggleButton
can 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 thetoggleGroup
property- See Also:
-
getToggleGroup
Gets the value of thetoggleGroup
property.- Specified by:
getToggleGroup
in interfaceToggle
- Property description:
- The
ToggleGroup
to which thisToggleButton
belongs. AToggleButton
can 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
toggleGroup
property - See Also:
-
toggleGroupProperty
TheToggleGroup
to which thisToggleButton
belongs. AToggleButton
can 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:
toggleGroupProperty
in interfaceToggle
- Returns:
- the
toggleGroup
property - See Also:
-
fire
public void fire()Invoked when a user gesture indicates that an event for thisButtonBase
should occur.If invoked, this method will be executed regardless of the status of
ButtonBase.arm()
.- Specified by:
fire
in classButtonBase
-
createDefaultSkin
Description copied from class:Control
Create 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-skin
or set explicitly in a sub-class withsetSkin(...)
.- Overrides:
createDefaultSkin
in 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.
-