- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.control.Control
-
- javafx.scene.control.Labeled
-
- javafx.scene.control.Cell<T>
-
- javafx.scene.control.IndexedCell<T>
-
- javafx.scene.control.TreeTableCell<S,T>
-
- javafx.scene.control.cell.ComboBoxTreeTableCell<S,T>
-
- 参数类型
-
S
- TreeTableView泛型类型的类型 -
T
- TreeTableColumn中包含的元素的类型。
- All Implemented Interfaces:
-
Styleable
,EventTarget
,Skinnable
public class ComboBoxTreeTableCell<S,T> extends TreeTableCell<S,T>
一个包含TreeTableCell
实现的类,在该单元格内绘制一个ComboBox
节点。默认情况下,ComboBoxTreeTableCell在不被编辑时呈现为
Label
,在编辑模式时作为ComboBox呈现。 默认情况下,ComboBox将拉伸以填充整个表格单元格。要创建一个ComboBoxTreeTableCell,当显示
ComboBox
菜单时,需要提供零个或多个将显示给用户的项目 。 这些项目必须与TreeTableColumn类型相同。- 从以下版本开始:
- JavaFX 8.0
-
-
Property Summary
Properties Type Property 描述 BooleanProperty
comboBoxEditable
表示ComboBox在向用户显示时是否可编辑的属性。ObjectProperty<StringConverter<T>>
converter
-
Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltip
-
Properties inherited from class javafx.scene.control.IndexedCell
index
-
Properties inherited from class javafx.scene.control.Labeled
alignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, labelPadding, lineSpacing, mnemonicParsing, textAlignment, textFill, textOverrun, text, underline, wrapText
-
Properties 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
-
Properties inherited from class javafx.scene.Parent
needsLayout
-
Properties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
-
Properties inherited from class javafx.scene.control.TreeTableCell
tableColumn, tableRow, treeTableView
-
-
Field Summary
-
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
-
-
构造方法摘要
构造方法 Constructor 描述 ComboBoxTreeTableCell()
创建一个带有空项目列表的默认ComboBoxTreeTableCell。ComboBoxTreeTableCell(ObservableList<T> items)
创建默认的ComboBoxTreeTableCell
实例,给定的项目用于在显示ComboBox
时填充ComboBox
。ComboBoxTreeTableCell(StringConverter<T> converter, ObservableList<T> items)
创建一个ComboBoxTreeTableCell
实例,给定的项目用于填充ComboBox
,当它被显示时,StringConverter
用于将项目转换为用户可读的形式。ComboBoxTreeTableCell(StringConverter<T> converter, T... items)
创建一个ComboBoxTreeTableCell
实例,给定的项目用于填充ComboBox
,并显示StringConverter
用于将项目转换为用户可读的形式。ComboBoxTreeTableCell(T... items)
创建默认的ComboBoxTreeTableCell
实例,给定的项目用于在显示ComboBox
时填充ComboBox
。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 void
cancelEdit()
调用此功能从编辑状态转换为非编辑状态,而不保存任何用户输入。BooleanProperty
comboBoxEditableProperty()
表示ComboBox在向用户显示时是否可编辑的属性。ObjectProperty<StringConverter<T>>
converterProperty()
static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>>
forTreeTableColumn(ObservableList<T> items)
创建ComboBox单元格工厂,用于TreeTableColumn
控件。static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>>
forTreeTableColumn(StringConverter<T> converter, ObservableList<T> items)
创建ComboBox单元格工厂,用于TreeTableColumn
控件。static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>>
forTreeTableColumn(StringConverter<T> converter, T... items)
创建ComboBox单元格工厂,用于TreeTableColumn
控件。static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>>
forTreeTableColumn(T... items)
创建ComboBox单元格工厂,用于TreeTableColumn
控件。StringConverter<T>
getConverter()
返回此单元格中使用的StringConverter
。ObservableList<T>
getItems()
返回要显示在ComboBox中的项目。boolean
isComboBoxEditable()
如果ComboBox是可编辑的,则返回true。void
setComboBoxEditable(boolean value)
将ComboBox配置为可编辑(允许用户输入超出下拉列表中提供的选项)。void
setConverter(StringConverter<T> value)
设置要在此单元格中使用的StringConverter
。void
startEdit()
调用此功能从非编辑状态转换到编辑状态,如果单元格是可编辑的。void
updateItem(T item, boolean empty)
updateItem方法不应该被开发人员调用,但它是开发人员覆盖的最佳方式,以允许它们自定义单元格的视觉效果。-
Methods inherited from class javafx.scene.control.Cell
editableProperty, editingProperty, emptyProperty, getInitialFocusTraversable, getItem, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, selectedProperty, setEditable, setItem
-
Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getCssMetaData, getSkin, getTooltip, isResizable, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
-
Methods inherited from class javafx.scene.control.IndexedCell
getIndex, indexProperty, updateIndex
-
Methods inherited from class javafx.scene.control.Labeled
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, getAlignment, getClassCssMetaData, getContentBias, getContentDisplay, getControlCssMetaData, 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, wrapTextProperty
-
Methods 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, visibleProperty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
-
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, 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, widthProperty
-
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
Methods inherited from class javafx.scene.control.TreeTableCell
commitEdit, createDefaultSkin, executeAccessibleAction, getTableColumn, getTreeTableRow, getTreeTableView, layoutChildren, queryAccessibleAttribute, tableColumnProperty, tableRowProperty, treeTableViewProperty, updateSelected, updateTreeTableColumn, updateTreeTableRow, updateTreeTableView
-
-
-
-
Property Detail
-
converter
public final ObjectProperty<StringConverter<T>> converterProperty
- 结果
- 字符串转换器属性
-
comboBoxEditable
public final BooleanProperty comboBoxEditableProperty
表示ComboBox在向用户显示时是否可编辑的属性。
-
-
构造方法详细信息
-
ComboBoxTreeTableCell
public ComboBoxTreeTableCell()
创建一个带有空项目列表的默认ComboBoxTreeTableCell。
-
ComboBoxTreeTableCell
@SafeVarargs public ComboBoxTreeTableCell(T... items)
创建默认的ComboBoxTreeTableCell
实例,给定的项目用于在显示ComboBox
时填充ComboBox
。- 参数
-
items
- 由用户选择时在ComboBox弹出菜单中显示的项目。
-
ComboBoxTreeTableCell
@SafeVarargs public ComboBoxTreeTableCell(StringConverter<T> converter, T... items)
创建一个ComboBoxTreeTableCell
实例,给定的项目用于填充ComboBox
,并显示StringConverter
用于将项目转换为用户可读的形式。- 参数
-
converter
- AStringConverter
可以将T型的项目转换为用户可读的字符串,以便可以在ComboBox弹出菜单中显示。 -
items
- 由用户选择时在ComboBox弹出菜单中显示的项目。
-
ComboBoxTreeTableCell
public ComboBoxTreeTableCell(ObservableList<T> items)
创建默认的ComboBoxTreeTableCell
实例,给定的项目用于在显示ComboBox
时填充ComboBox
。- 参数
-
items
- 由用户选择时在ComboBox弹出菜单中显示的项目。
-
ComboBoxTreeTableCell
public ComboBoxTreeTableCell(StringConverter<T> converter, ObservableList<T> items)
创建一个ComboBoxTreeTableCell
实例,给定的项目用于在显示ComboBox
时填充ComboBox
,而StringConverter
用于将项目转换为用户可读的形式。- 参数
-
converter
- AStringConverter
,它可以将类型T的项目转换为用户可读的字符串,从而可以在ComboBox弹出菜单中显示。 -
items
- 由用户选择时在ComboBox弹出菜单中显示的项目。
-
-
方法详细信息
-
forTreeTableColumn
@SafeVarargs public static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>> forTreeTableColumn(T... items)
创建ComboBox单元格工厂,用于TreeTableColumn
控件。 默认情况下,ComboBoxCell在不被编辑时呈现为Label
,而在编辑模式下则为 ComboBox。 默认情况下,ComboBox将拉伸以填充整个列表单元格。- 参数类型
-
S
- TreeTableView泛型类型的类型 -
T
- TreeTableColumn中包含的元素的类型。 - 参数
-
items
- 当显示ComboBox
菜单时将显示给用户的零个或多个项目。 这些项目必须与TreeTableColumn类型相同。 请注意,由开发人员设置event handlers
以监听TreeTableColumn中的编辑事件,并作出相应的反应。 感兴趣的方法包括:setOnEditStart
,setOnEditCommit
,并setOnEditCancel
。 - 结果
-
A
Callback
将返回一个TreeTableCell,它能够处理TreeTableColumn中包含的元素的类型。
-
forTreeTableColumn
@SafeVarargs public static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>> forTreeTableColumn(StringConverter<T> converter, T... items)
创建ComboBox单元格工厂,用于TreeTableColumn
控件。 默认情况下,ComboBoxCell在不被编辑时被渲染为Label
,在编辑模式时作为ComboBox呈现。 默认情况下,ComboBox将拉伸以填充整个列表单元格。- 参数类型
-
S
- TreeTableView泛型类型的类型 -
T
- TreeTableColumn中包含的元素的类型。 - 参数
-
converter
- AStringConverter
将给定项目(类型T)转换为用于显示给用户的字符串。 -
items
- 当显示ComboBox
菜单时将显示给用户的零个或多个项目。 这些项目必须与TreeTableColumn类型相同。 请注意,由开发人员设置event handlers
以监听TreeTableColumn中的编辑事件,并作出相应的反应。 感兴趣的方法包括:setOnEditStart
,setOnEditCommit
,并setOnEditCancel
。 - 结果
-
A
Callback
将返回一个TreeTableCell,它可以处理TreeTableColumn中包含的元素的类型。
-
forTreeTableColumn
public static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>> forTreeTableColumn(ObservableList<T> items)
创建ComboBox单元格工厂用于TreeTableColumn
控件。 默认情况下,ComboBoxCell在不被编辑时呈现为Label
,在编辑模式时则作为ComboBox呈现。 默认情况下,ComboBox将拉伸以填充整个列表单元格。- 参数类型
-
S
- TreeTableView泛型类型的类型 -
T
- TreeTableColumn中包含的元素的类型。 - 参数
-
items
- 当显示ComboBox
菜单时将显示给用户的零个或多个项目。 这些项目必须与TreeTableColumn类型相同。 请注意,由开发人员设置event handlers
以监听TreeTableColumn中的编辑事件,并作出相应的响应。 感兴趣的方法包括:setOnEditStart
,setOnEditCommit
,并setOnEditCancel
。 - 结果
-
A
Callback
将返回一个TreeTableCell,它能够处理TreeTableColumn中包含的元素的类型。
-
forTreeTableColumn
public static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>> forTreeTableColumn(StringConverter<T> converter, ObservableList<T> items)
创建ComboBox单元格工厂,用于TreeTableColumn
控件。 默认情况下,ComboBoxCell在不被编辑时呈现为Label
,在编辑模式时则作为ComboBox呈现。 默认情况下,ComboBox将拉伸以填充整个列表单元格。- 参数类型
-
S
- TreeTableView泛型类型的类型 -
T
- TreeTableColumn中包含的元素的类型。 - 参数
-
converter
- AStringConverter
将给定项目(类型T)转换为用于显示给用户的字符串。 -
items
- 当显示ComboBox
菜单时,将显示给用户的零个或多个项目。 这些项目必须与TreeTableColumn类型相同。 请注意,由开发人员设置event handlers
以监听TreeTableColumn中的编辑事件,并作出相应的响应。 感兴趣的方法包括:setOnEditStart
,setOnEditCommit
,并setOnEditCancel
。 - 结果
-
A
Callback
将返回一个TreeTableCell,它可以处理TreeTableColumn中包含的元素的类型。
-
converterProperty
public final ObjectProperty<StringConverter<T>> converterProperty()
- 结果
- 字符串转换器属性
-
setConverter
public final void setConverter(StringConverter<T> value)
设置要在此单元格中使用的StringConverter
。- 参数
-
value
- 字符串转换器
-
getConverter
public final StringConverter<T> getConverter()
返回此单元格中使用的StringConverter
。- 结果
- 字符串转换器
-
comboBoxEditableProperty
public final BooleanProperty comboBoxEditableProperty()
表示ComboBox在向用户显示时是否可编辑的属性。
-
setComboBoxEditable
public final void setComboBoxEditable(boolean value)
将ComboBox配置为可编辑(允许用户输入超出下拉列表中提供的选项)。- 参数
-
value
- 要为此ComboBox设置的可编辑值
-
isComboBoxEditable
public final boolean isComboBoxEditable()
如果ComboBox是可编辑的,则返回true。- 结果
- 如果ComboBox是可编辑的,则为true
-
getItems
public ObservableList<T> getItems()
返回要显示在ComboBox中的项目。- 结果
- 当该组合框显示时要显示的项目
-
startEdit
public void startEdit()
调用此功能从非编辑状态转换到编辑状态,如果单元格是可编辑的。 如果这个单元格已经处于编辑状态,它将保留在它中。- 重写:
-
startEdit
在TreeTableCell<S,T>
-
cancelEdit
public void cancelEdit()
调用此功能从编辑状态转换为非编辑状态,而不保存任何用户输入。- 重写:
-
cancelEdit
在TreeTableCell<S,T>
-
updateItem
public void updateItem(T item, boolean empty)
updateItem方法不应该被开发人员调用,但它是开发人员覆盖的最佳方式,以允许它们自定义单元格的视觉效果。 为了澄清,开发人员不应该在他们的代码中调用这个方法(他们应该留给UI控件,如ListView
控件)来调用这个方法。 然而,使用updateItem方法的目的是使开发人员在指定自定义单元工厂时(再次像ListViewcell factory
),可以覆盖updateItem方法以允许对单元格进行完全自定义。非常重要的是,Cell的子类会正确覆盖updateItem方法,因为这样做会导致诸如空白单元格或其中出现意外内容的单元格等问题。 以下是如何正确覆盖updateItem方法的示例:
protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); if (empty || item == null) { setText(null); setGraphic(null); } else { setText(item.toString()); } }
注意在这段代码示例中的两个重点:
- 我们称之为super.updateItem(T,boolean)方法。 如果没有这样做,项目和空属性设置不正确,您可能会遇到图形问题。
- 我们测试
empty
条件,如果为true,我们将文本和图形属性设置为null。 如果我们不这样做,几乎可以保证最终用户意外地看到细胞中的图形工件。
- 重写:
-
updateItem
在Cell<T>
- 参数
-
item
- 单元格的新项目。 -
empty
- whether or not this cell represents data from the list. If it is empty, then it does not represent any domain data, but is a cell being used to render an "empty" row.
-
-