See: Description
Interface | Description |
---|---|
Skin<C extends Skinnable> |
Base class for defining the visual representation of user interface controls
by defining a scene graph of nodes to represent the skin.
|
Skinnable |
The Skinnable interface is implemented by the
Control class,
and therefore is implemented by all Control implementations. |
TextInputControl.Content |
Interface representing a text input's content.
|
Toggle |
Represents a control that can be toggled between selected and non-selected
states.
|
Class | Description |
---|---|
Accordion |
An accordion is a group of
TitlePanes . |
AccordionBuilder<B extends AccordionBuilder<B>> |
Builder class for javafx.scene.control.Accordion
|
Button |
A simple button control.
|
ButtonBase |
Base class for button-like UI Controls, including Hyperlinks, Buttons,
ToggleButtons, CheckBoxes, and RadioButtons.
|
ButtonBaseBuilder<B extends ButtonBaseBuilder<B>> |
Builder class for javafx.scene.control.ButtonBase
|
ButtonBuilder<B extends ButtonBuilder<B>> |
Builder class for javafx.scene.control.Button
|
Cell<T> | |
CellBuilder<T,B extends CellBuilder<T,B>> |
Builder class for javafx.scene.control.Cell
|
CheckBox |
A tri-state selection Control typically skinned as a box with a checkmark or
tick mark when checked.
|
CheckBoxBuilder<B extends CheckBoxBuilder<B>> |
Builder class for javafx.scene.control.CheckBox
|
CheckBoxTreeItem<T> |
TreeItem subclass that adds support for being in selected, unselected, and
indeterminate states.
|
CheckBoxTreeItem.TreeModificationEvent<T> |
A TreeModificationEvent class that works in a similar vein to the
TreeItem.TreeModificationEvent class, in that
this event will bubble up the CheckBoxTreeItem hierarchy, until the parent
node is null. |
CheckBoxTreeItemBuilder<T,B extends CheckBoxTreeItemBuilder<T,B>> |
Builder class for javafx.scene.control.CheckBoxTreeItem
|
CheckMenuItem |
A
MenuItem that can be toggled between selected and unselected states. |
CheckMenuItemBuilder<B extends CheckMenuItemBuilder<B>> |
Builder class for javafx.scene.control.CheckMenuItem
|
ChoiceBox<T> |
The ChoiceBox is used for presenting the user with a relatively small set of
predefined choices from which they may choose.
|
ChoiceBoxBuilder<T,B extends ChoiceBoxBuilder<T,B>> |
Builder class for javafx.scene.control.ChoiceBox
|
ColorPicker |
ColorPicker control allows the user to select a color from either a standard
palette of colors with a simple one click selection OR define their own custom color.
|
ColorPickerBuilder<B extends ColorPickerBuilder<B>> |
Builder class for javafx.scene.control.ColorPicker
|
ComboBox<T> |
An implementation of the
ComboBoxBase abstract class for the most common
form of ComboBox, where a popup list is shown to users providing them with
a choice that they may select from. |
ComboBoxBase<T> |
Abstract base class for ComboBox-like controls.
|
ComboBoxBaseBuilder<T,B extends ComboBoxBaseBuilder<T,B>> |
Builder class for javafx.scene.control.ComboBoxBase
|
ComboBoxBuilder<T,B extends ComboBoxBuilder<T,B>> |
Builder class for javafx.scene.control.ComboBox
|
ContextMenu |
A popup control containing an ObservableList of menu items.
|
ContextMenuBuilder<B extends ContextMenuBuilder<B>> |
Builder class for javafx.scene.control.ContextMenu
|
Control |
Base class for all user interface controls.
|
ControlBuilder<B extends ControlBuilder<B>> |
Builder class for javafx.scene.control.Control
|
CustomMenuItem | |
CustomMenuItemBuilder<B extends CustomMenuItemBuilder<B>> |
Builder class for javafx.scene.control.CustomMenuItem
|
FocusModel<T> |
The abstract base class for FocusModel implementations.
|
Hyperlink |
An HTML like label which can be a graphic and/or text which responds to rollovers and clicks.
|
HyperlinkBuilder<B extends HyperlinkBuilder<B>> |
Builder class for javafx.scene.control.Hyperlink
|
IndexedCell<T> |
An implementation of
Cell which contains an index property which maps
into the data model underlying the visualization. |
IndexedCellBuilder<T,B extends IndexedCellBuilder<T,B>> |
Builder class for javafx.scene.control.IndexedCell
|
IndexRange |
Class representing a contiguous range of integral values.
|
IndexRangeBuilder |
Builder class for javafx.scene.control.IndexRange
|
Label |
Label is a non-editable text control.
|
LabelBuilder<B extends LabelBuilder<B>> |
Builder class for javafx.scene.control.Label
|
Labeled |
A Labeled
Control is one which has as part of its user interface
a textual content associated with it. |
LabeledBuilder<B extends LabeledBuilder<B>> |
Builder class for javafx.scene.control.Labeled
|
ListCell<T> | |
ListCellBuilder<T,B extends ListCellBuilder<T,B>> |
Builder class for javafx.scene.control.ListCell
|
ListView<T> |
A ListView displays a horizontal or vertical list of items from which the
user may select, or with which the user may interact.
|
ListView.EditEvent<T> |
An
Event subclass used specifically in ListView for representing
edit-related events. |
ListViewBuilder<T,B extends ListViewBuilder<T,B>> |
Builder class for javafx.scene.control.ListView
|
Menu |
A popup menu of actionable items which is displayed to the user only upon request.
|
MenuBar |
A MenuBar control traditionally is placed at the very top of the user
interface, and embedded within it are
Menus . |
MenuBarBuilder<B extends MenuBarBuilder<B>> |
Builder class for javafx.scene.control.MenuBar
|
MenuBuilder<B extends MenuBuilder<B>> |
Builder class for javafx.scene.control.Menu
|
MenuButton |
MenuButton is a button which, when clicked or pressed, will show a
ContextMenu . |
MenuButtonBuilder<B extends MenuButtonBuilder<B>> |
Builder class for javafx.scene.control.MenuButton
|
MenuItem |
MenuItem is intended to be used in conjunction with
Menu to provide
options to users. |
MenuItemBuilder<B extends MenuItemBuilder<B>> |
Builder class for javafx.scene.control.MenuItem
|
MultipleSelectionModel<T> |
An abstract class that extends
SelectionModel to add API to support
multiple selection. |
MultipleSelectionModelBuilder<T,B extends MultipleSelectionModelBuilder<T,B>> |
Builder class for javafx.scene.control.MultipleSelectionModel
|
Pagination |
A Pagination control is used for navigation between pages of a single content,
which has been divided into smaller parts.
|
PaginationBuilder<B extends PaginationBuilder<B>> |
Builder class for javafx.scene.control.Pagination
|
PasswordField |
Text field that masks entered characters.
|
PasswordFieldBuilder<B extends PasswordFieldBuilder<B>> |
Builder class for javafx.scene.control.PasswordField
|
PopupControl |
An extension of PopupWindow that allows for CSS styling.
|
PopupControlBuilder<B extends PopupControlBuilder<B>> |
Builder class for javafx.scene.control.PopupControl
|
ProgressBar |
A specialization of the ProgressIndicator which is represented as a
horizontal bar.
|
ProgressBarBuilder<B extends ProgressBarBuilder<B>> |
Builder class for javafx.scene.control.ProgressBar
|
ProgressIndicator |
A circular control which is used for indicating progress, either
infinite (aka indeterminate) or finite.
|
ProgressIndicatorBuilder<B extends ProgressIndicatorBuilder<B>> |
Builder class for javafx.scene.control.ProgressIndicator
|
RadioButton |
RadioButtons create a series of items where only one item can be
selected.
|
RadioButtonBuilder<B extends RadioButtonBuilder<B>> |
Builder class for javafx.scene.control.RadioButton
|
RadioMenuItem | |
RadioMenuItemBuilder<B extends RadioMenuItemBuilder<B>> |
Builder class for javafx.scene.control.RadioMenuItem
|
ScrollBar |
Either a horizontal or vertical bar with increment and decrement buttons and
a "thumb" with which the user can interact.
|
ScrollBarBuilder<B extends ScrollBarBuilder<B>> |
Builder class for javafx.scene.control.ScrollBar
|
ScrollPane |
A Control that provides a scrolled, clipped viewport of its contents.
|
ScrollPaneBuilder<B extends ScrollPaneBuilder<B>> |
Builder class for javafx.scene.control.ScrollPane
|
SelectionModel<T> |
SelectionModel is an abstract class used by UI controls to provide a
consistent API for maintaining selection.
|
Separator |
A horizontal or vertical separator line.
|
SeparatorBuilder<B extends SeparatorBuilder<B>> |
Builder class for javafx.scene.control.Separator
|
SeparatorMenuItem |
A
MenuItem that as the name suggests allows for a horizontal Separator to be embedded within it,
by assigning a Separator to the content property of the CustomMenuItem
This is provided for convenience as groups of menuitems can be separated
by a separator. |
SeparatorMenuItemBuilder<B extends SeparatorMenuItemBuilder<B>> |
Builder class for javafx.scene.control.SeparatorMenuItem
|
SingleSelectionModel<T> |
A SelectionModel which enforces the requirement that only a single index
be selected at any given time.
|
Slider |
The Slider Control is used to display a continuous or discrete range of
valid numeric choices and allows the user to interact with the control.
|
SliderBuilder<B extends SliderBuilder<B>> |
Builder class for javafx.scene.control.Slider
|
SplitMenuButton |
The SplitMenuButton, like the
MenuButton is closely associated with
the concept of selecting a MenuItem from a menu. |
SplitMenuButtonBuilder<B extends SplitMenuButtonBuilder<B>> |
Builder class for javafx.scene.control.SplitMenuButton
|
SplitPane |
A control that has two or more sides, each separated by a divider, which can be
dragged by the user to give more space to one of the sides, resulting in
the other side shrinking by an equal amount.
|
SplitPane.Divider |
Represents a single divider in the SplitPane.
|
SplitPaneBuilder<B extends SplitPaneBuilder<B>> |
Builder class for javafx.scene.control.SplitPane
|
Tab |
Tabs are placed within a
TabPane , where each tab represents a single
'page'. |
TabBuilder<B extends TabBuilder<B>> |
Builder class for javafx.scene.control.Tab
|
TableCell<S,T> |
Represents a single row/column intersection in a
TableView . |
TableCellBuilder<S,T,B extends TableCellBuilder<S,T,B>> |
Builder class for javafx.scene.control.TableCell
|
TableColumn<S,T> |
A
TableView is made up of a number of TableColumn instances. |
TableColumn.CellDataFeatures<S,T> |
A support class used in TableColumn as a wrapper class
to provide all necessary information for a particular
Cell . |
TableColumn.CellEditEvent<S,T> |
An event that is fired when a user performs an edit on a table cell.
|
TableColumnBuilder<S,T,B extends TableColumnBuilder<S,T,B>> |
Builder class for javafx.scene.control.TableColumn
|
TablePosition<S,T> |
This class is used to represent a single row/column/cell in a TableView.
|
TablePositionBuilder<S,T,B extends TablePositionBuilder<S,T,B>> |
Builder class for javafx.scene.control.TablePosition
|
TableRow<T> |
TableRow is an
IndexedCell , but
rarely needs to be used by developers creating TableView instances. |
TableRowBuilder<T,B extends TableRowBuilder<T,B>> |
Builder class for javafx.scene.control.TableRow
|
TableView<S> |
The TableView control is designed to visualize an unlimited number of rows
of data, broken out into columns.
|
TableView.ResizeFeatures<S> |
An immutable wrapper class for use in the TableView
column resize functionality. |
TableView.TableViewFocusModel<S> |
A
FocusModel with additional functionality to support the requirements
of a TableView control. |
TableView.TableViewSelectionModel<S> |
A simple extension of the
SelectionModel abstract class to
allow for special support for TableView controls. |
TableViewBuilder<S,B extends TableViewBuilder<S,B>> |
Builder class for javafx.scene.control.TableView
|
TabPane |
A control that allows switching between a group of
Tabs . |
TabPaneBuilder<B extends TabPaneBuilder<B>> |
Builder class for javafx.scene.control.TabPane
|
TextArea |
Text input component that allows a user to enter multiple lines of
plain text.
|
TextAreaBuilder<B extends TextAreaBuilder<B>> |
Builder class for javafx.scene.control.TextArea
|
TextField |
Text input component that allows a user to enter a single line of
unformatted text.
|
TextFieldBuilder<B extends TextFieldBuilder<B>> |
Builder class for javafx.scene.control.TextField
|
TextInputControl |
Abstract base class for text input controls.
|
TextInputControlBuilder<B extends TextInputControlBuilder<B>> |
Builder class for javafx.scene.control.TextInputControl
|
TitledPane |
A TitledPane is a panel with a title that can be opened and closed.
|
TitledPaneBuilder<B extends TitledPaneBuilder<B>> |
Builder class for javafx.scene.control.TitledPane
|
ToggleButton |
A
ToggleButton is a specialized control which has the ability to be
selected. |
ToggleButtonBuilder<B extends ToggleButtonBuilder<B>> |
Builder class for javafx.scene.control.ToggleButton
|
ToggleGroup |
A class which contains a reference to all
Toggles whose
selected variables should be managed such that only a single
within the ToggleGroup may be selected at
any one time. |
ToggleGroupBuilder<B extends ToggleGroupBuilder<B>> |
Builder class for javafx.scene.control.ToggleGroup
|
ToolBar |
A ToolBar is a control which displays items horizontally
or vertically.
|
ToolBarBuilder<B extends ToolBarBuilder<B>> |
Builder class for javafx.scene.control.ToolBar
|
Tooltip |
Tooltips are common UI elements which are typically used for showing
additional information about a Control when the Control is hovered over by
the mouse.
|
TooltipBuilder<B extends TooltipBuilder<B>> |
Builder class for javafx.scene.control.Tooltip
|
TreeCell<T> | |
TreeCellBuilder<T,B extends TreeCellBuilder<T,B>> |
Builder class for javafx.scene.control.TreeCell
|
TreeItem<T> |
The model for a single node supplying a hierarchy of values to a control such
as TreeView.
|
TreeItem.TreeModificationEvent<T> |
An
Event that contains relevant information for all forms of
TreeItem modifications. |
TreeItemBuilder<T,B extends TreeItemBuilder<T,B>> |
Builder class for javafx.scene.control.TreeItem
|
TreeView<T> |
The TreeView control provides a view on to a tree root (of type
TreeItem ). |
TreeView.EditEvent<T> |
An
Event subclass used specifically in TreeView for representing
edit-related events. |
TreeViewBuilder<T,B extends TreeViewBuilder<T,B>> |
Builder class for javafx.scene.control.TreeView
|
Enum | Description |
---|---|
ContentDisplay |
The position to place the content within a Label.
|
OverrunStyle |
Defines the behavior of a labeled Control when the space for rendering the
text is smaller than the space needed to render the entire string.
|
ScrollPane.ScrollBarPolicy |
An enumeration denoting the policy to be used by a scrollable
Control in deciding whether to show a scroll bar.
|
SelectionMode |
An enumeration used to specify how many items may be selected in a
MultipleSelectionModel . |
TableColumn.SortType |
Enumeration that specifies the type of sorting being applied to a specific
column.
|
TabPane.TabClosingPolicy |
This specifies how the TabPane handles tab closing from an end-users
perspective.
|
The JavaFX User Interface Controls (UI Controls or just Controls) are
specialized Nodes in the JavaFX Scenegraph especially suited for reuse in
many different application contexts. They are designed to be highly
customizable visually by designers and developers. They are designed to work
well with layout systems. Examples of prominent controls include Button
,
Label
, ListView
, and TextField
.
Since Controls are Nodes
in the scenegraph,
they can be freely mixed with Groups
,
Images
,
Media
,
Text
, and
basic geometric shapes
. While
writing new UI Controls is not trivial, using and styling them
is very easy, especially to existing web developers.
The remainder of this document will describe the basic architecture of the JavaFX UI Control library, how to style existing controls, write custom skins, and how to use controls to build up more complicated user interfaces.
Controls follow the classic MVC design pattern. The Control
is
the "model". It contains both the state and the functions which manipulate
that state. The Control class itself does not know how it is rendered or
what the user interaction is. These tasks are delegated to the
Skin
("view"), which may internally separate
out the view and controller functionality into separate classes, although
at present there is no public API for the "controller" aspect.
All Controls extend from the Control class, which is in turn a
Parent
node, and which is a
Node
. Every Control has a reference to a single Skin, which
is the view implementation for the Control. The Control delegates to the
Skin the responsibility of computing the min, max, and pref sizes of the
Control, the baseline offset, and hit testing (containment and
intersection). It is also the responsibility of the Skin, or a delegate of
the Skin, to implement and repond to all relevant key
events which occur on the Control when it contains the focus.
Control extends from Parent
, and as such, is
not a leaf node. From the perspective of a developer or designer the Control
can be thought of as if it were a leaf node in many cases. For example, the
developer or designer can consider a Button as if it were a Rectangle or
other simple leaf node.
Since a Control is resizable, a Control will be auto-sized to its preferred size on each scenegraph pulse. Setting the width and height of the Control does not affect its preferred size. When used in a layout container, the layout constraints imposed upon the Control (or manually specified on the Control) will determine how it is positioned and sized.
The Skin of a Control can be changed at any time. Doing so will mark the Control as needing to be laid out since changing the Skin likely has changed the preferred size of the Control. If no Skin is specified at the time that the Control is created, then a default CSS-based skin will be provided for all of the built-in Controls.
Each Control may have an optional tooltip specified. The Tooltip is a Control which displays some (usually textual) information about the control to the user when the mouse hovers over the Control from some period of time. It can be styled from CSS the same as with other Controls.
focusTraversable
is overridden in Control to be true by default,
whereas with Node it is false by default. Controls which should not be
focusable by default (such as Label) override this to be false.
The getMinWidth, getMinHeight, getPrefWidth, getPrefHeight, getMaxWidth, and getMaxHeight functions are delegated directly to the Skin. The baselineOffset method is delegated to the node of the skin. It is not recommended that subclasses alter these delegations.
There are two methods for customizing the look of a Control. The most difficult and yet most flexible approach is to write a new Skin for the Control which precisely implements the visuals which you desire for the Control. Consult the Skin documentation for more details.
The easiest and yet very powerful method for styling the built in Controls is by using CSS. Please note that in this release the following CSS description applies only to the default Skins provided for the built in Controls. Subsequent releases will make this generally available for any custom third party Controls which desire to take advantage of these CSS capabilities.
Each of the default Skins for the built in Controls is comprised of multiple individually styleable areas or regions. This is much like an HTML page which is made up of <div>'s and then styled from CSS. Each individual region may be drawn with backgrounds, borders, images, padding, margins, and so on. The JavaFX CSS support includes the ability to have multiple backgrounds and borders, and to derive colors. These capabilities make it extremely easy to alter the look of Controls in JavaFX from CSS.
The colors used for drawing the default Skins of the built in Controls are all derived from a base color, an accent color and a background color. Simply by modifying the base color for a Control you can alter the derived gradients and create Buttons or other Controls which visually fit in with the default Skins but visually stand out.
As with all other Nodes in the scenegraph, Controls can be styled by using an external stylesheet, or by specifying the style directly on the Control. Although for examples it is easier to express and understand by specifying the style directly on the Node, it is recommended to use an external stylesheet and use either the styleClass or id of the Control, just as you would use the "class" or id of an HTML element with HTML CSS.
Each UI Control specifies a styleClass which may be used to style controls from an external stylesheet. For example, the Button control is given the "button" CSS style class. The CSS style class names are hyphen-separated lower case as opposed to camel case, otherwise, they are exactly the same. For example, Button is "button", RadioButton is "radio-button", Tooltip is "tooltip" and so on.
The class documentation for each Control defines the default Skin regions which can be styled. For further information regarding the CSS capabilities provided with JavaFX, see the CSS Reference Guide.
Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.