Top Description Inners Fields Constructors Methods
com.sun.javafx.charts

public Class Legend

extends TilePane
Class Inheritance
Imports
java.util.List, java.util.stream.Collectors, javafx.beans.property.BooleanProperty, .BooleanPropertyBase, .ObjectProperty, .ObjectPropertyBase, .StringProperty, .StringPropertyBase, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, javafx.geometry.Orientation, .Pos, javafx.scene.Node, javafx.scene.control.ContentDisplay, .Label, javafx.scene.layout.Region, .TilePane

A chart legend that displays a list of items with symbols in a box

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Legend.LegendItem

A item to be displayed on a Legend

Field Summary

Modifier and TypeField and Description
private static final int
private ObjectProperty<ObservableList<Legend.LegendItem>>
items

The legend items to display in this legend

private ListChangeListener<Legend.LegendItem>
private BooleanProperty
vertical

The legend items should be laid out vertically in columns rather than horizontally in rows

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected double
computePrefHeight(double
the width that should be used if preferred height depends on it
forWidth
)

Overrides javafx.scene.layout.TilePane.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy.

protected double
computePrefWidth(double
the height that should be used if preferred width depends on it
forHeight
)

Overrides javafx.scene.layout.TilePane.computePrefWidth.

Computes the preferred width of this region for the given height.

public final ObservableList<Legend.LegendItem>
public final boolean
public final ObjectProperty<ObservableList<Legend.LegendItem>>
public final void
public final void
setVertical(boolean value)

public final BooleanProperty
Inherited from javafx.scene.layout.TilePane:
alignmentPropertyclearConstraintscomputeMinHeightcomputeMinWidthgetAlignmentgetAlignmentgetClassCssMetaDatagetContentBiasgetCssMetaDatagetHgapgetMargingetOrientationgetPrefColumnsgetPrefRowsgetPrefTileHeightgetPrefTileWidthgetTileAlignmentgetTileHeightgetTileWidthgetVgaphgapPropertylayoutChildrenorientationPropertyprefColumnsPropertyprefRowsPropertyprefTileHeightPropertyprefTileWidthPropertyrequestLayoutsetAlignmentsetAlignmentsetHgapsetMarginsetOrientationsetPrefColumnssetPrefRowssetPrefTileHeightsetPrefTileWidthsetTileAlignmentsetVgaptileAlignmentPropertytileHeightPropertytileWidthPropertyvgapProperty

Field Detail

GAPback to summary
private static final int GAP
itemsback to summary
private ObjectProperty<ObservableList<Legend.LegendItem>> items

The legend items to display in this legend

itemsListenerback to summary
private ListChangeListener<Legend.LegendItem> itemsListener
verticalback to summary
private BooleanProperty vertical

The legend items should be laid out vertically in columns rather than horizontally in rows

Constructor Detail

Legendback to summary
public Legend()

Method Detail

computePrefHeightback to summary
protected double computePrefHeight(double forWidth)

Overrides javafx.scene.layout.TilePane.computePrefHeight.

Doc from javafx.scene.layout.Region.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.

Parameters
forWidth:double

Doc from javafx.scene.Parent.computePrefHeight.

the width that should be used if preferred height depends on it

Returns:double

the computed preferred height for this region

Annotations
@Override
computePrefWidthback to summary
protected double computePrefWidth(double forHeight)

Overrides javafx.scene.layout.TilePane.computePrefWidth.

Doc from javafx.scene.layout.Region.computePrefWidth.

Computes the preferred width of this region for the given height. Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a VERTICAL content bias, then the height parameter can be ignored.

Parameters
forHeight:double

Doc from javafx.scene.Parent.computePrefWidth.

the height that should be used if preferred width depends on it

Returns:double

the computed preferred width for this region

Annotations
@Override
getItemsback to summary
public final ObservableList<Legend.LegendItem> getItems()
isVerticalback to summary
public final boolean isVertical()
itemsPropertyback to summary
public final ObjectProperty<ObservableList<Legend.LegendItem>> itemsProperty()
setItemsback to summary
public final void setItems(ObservableList<Legend.LegendItem> value)
setVerticalback to summary
public final void setVertical(boolean value)
verticalPropertyback to summary
public final BooleanProperty verticalProperty()
com.sun.javafx.charts back to summary

public Class Legend.LegendItem

extends Object
Class Inheritance

A item to be displayed on a Legend

Field Summary

Modifier and TypeField and Description
private Label
label

Label used to represent the legend item

private ObjectProperty<Node>
symbol

The symbol to use next to the item text, set to null for no symbol.

private StringProperty
text

The item text

Constructor Summary

AccessConstructor and Description
public
public
LegendItem(String text, Node symbol)

Method Summary

Modifier and TypeMethod and Description
public final Node
public final String
public final void
setSymbol(Node value)

public final void
setText(String value)

public final ObjectProperty<Node>
public final StringProperty
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

labelback to summary
private Label label

Label used to represent the legend item

symbolback to summary
private ObjectProperty<Node> symbol

The symbol to use next to the item text, set to null for no symbol. The default is a simple square of symbolFill

textback to summary
private StringProperty text

The item text

Constructor Detail

LegendItemback to summary
public LegendItem(String text)
LegendItemback to summary
public LegendItem(String text, Node symbol)

Method Detail

getSymbolback to summary
public final Node getSymbol()
getTextback to summary
public final String getText()
setSymbolback to summary
public final void setSymbol(Node value)
setTextback to summary
public final void setText(String value)
symbolPropertyback to summary
public final ObjectProperty<Node> symbolProperty()
textPropertyback to summary
public final StringProperty textProperty()