当前位置: 首页>>代码示例>>Java>>正文


Java Cell类代码示例

本文整理汇总了Java中javafx.scene.control.Cell的典型用法代码示例。如果您正苦于以下问题:Java Cell类的具体用法?Java Cell怎么用?Java Cell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Cell类属于javafx.scene.control包,在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTextField

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> TextField createTextField(final Cell<T> cell, final StringConverter<T> converter) {
    final TextField textField = new TextField(getItemText(cell, converter));

    // Use onAction here rather than onKeyReleased (with check for Enter),
    // as otherwise we encounter RT-34685
    textField.setOnAction(event -> {
        if (converter == null) {
            throw new IllegalStateException(
                    "Attempting to convert text input into Object, but provided "
                    + "StringConverter is null. Be sure to set a StringConverter "
                    + "in your cell factory.");
        }
        cell.commitEdit(converter.fromString(textField.getText()));
        event.consume();
    });
    textField.setOnKeyReleased(t -> {
        if (t.getCode() == KeyCode.ESCAPE) {
            cell.cancelEdit();
            t.consume();
        }
    });
    return textField;
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:24,代码来源:CellUtils.java

示例2: updateItem

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> void updateItem(final Cell<T> cell,
        final StringConverter<T> converter,
        final HBox hbox,
        final Node graphic,
        final ChoiceBox<T> choiceBox
) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else if (cell.isEditing()) {
        if (choiceBox != null) {
            choiceBox.getSelectionModel().select(cell.getItem());
        }
        cell.setText(null);

        if (graphic != null) {
            hbox.getChildren().setAll(graphic, choiceBox);
            cell.setGraphic(hbox);
        } else {
            cell.setGraphic(choiceBox);
        }
    } else {
        cell.setText(getItemText(cell, converter));
        cell.setGraphic(graphic);
    }
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:27,代码来源:CellUtils.java

示例3: startEdit

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> void startEdit(final Cell<T> cell,
        final StringConverter<T> converter,
        final HBox hbox,
        final Node graphic,
        final TextField textField
) {
    if (textField != null) {
        textField.setText(getItemText(cell, converter));
    }
    cell.setText(null);

    if (graphic != null) {
        hbox.getChildren().setAll(graphic, textField);
        cell.setGraphic(hbox);
    } else {
        cell.setGraphic(textField);
    }

    textField.selectAll();

    // requesting focus so that key input can immediately go into the
    // TextField (see RT-28132)
    textField.requestFocus();
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:25,代码来源:CellUtils.java

示例4: updateItem

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> void updateItem(final Cell<T> cell, final StringConverter<T> converter, final HBox hbox, final Node graphic,
		final TextField textField) {
	if (cell.isEmpty()) {
		cell.setText(null);
		cell.setGraphic(null);
	} else {
		if (cell.isEditing()) {
			if (textField != null) {
				textField.setText(getItemText(cell, converter));
			}
			cell.setText(null);

			if (graphic != null) {
				hbox.getChildren().setAll(graphic, textField);
				cell.setGraphic(hbox);
			} else {
				cell.setGraphic(textField);
			}
		} else {
			cell.setText(getItemText(cell, converter));
			cell.setGraphic(graphic);
		}
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:25,代码来源:PasswordTextFieldTableCell.java

示例5: startEdit

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> void startEdit(final Cell<T> cell, final StringConverter<T> converter, final HBox hbox, final Node graphic,
		final TextField textField) {
	if (textField != null) {
		textField.setText(getItemText(cell, converter));
	}
	cell.setText(null);

	if (graphic != null) {
		hbox.getChildren().setAll(graphic, textField);
		cell.setGraphic(hbox);
	} else {
		cell.setGraphic(textField);
	}

	textField.selectAll();

	// requesting focus so that key input can immediately go into the
	// TextField (see RT-28132)
	textField.requestFocus();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:21,代码来源:PasswordTextFieldTableCell.java

示例6: createTextField

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> TextField createTextField(final Cell<T> cell, final StringConverter<T> converter) {
	final TextField textField = new TextField();
	textField.setPromptText("user password.");
	textField.setText(getItemText(cell, converter));
	// Use onAction here rather than onKeyReleased (with check for Enter),
	// as otherwise we encounter RT-34685
	textField.setOnAction(event -> {
		if (converter == null) {
			throw new IllegalStateException("Attempting to convert text input into Object, but provided "
					+ "StringConverter is null. Be sure to set a StringConverter " + "in your cell factory.");
		}
		cell.commitEdit(converter.fromString(textField.getText()));
		event.consume();
	});
	textField.setOnKeyReleased(t -> {
		if (t.getCode() == KeyCode.ESCAPE) {
			cell.cancelEdit();
			t.consume();
		}
	});
	return textField;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:23,代码来源:PasswordTextFieldTableCell.java

示例7: cellWithValue

import javafx.scene.control.Cell; //导入依赖的package包/类
@Factory
public static <T> Matcher<Node> cellWithValue(final Matcher<T> contentsMatcher) {
    return new TypeSafeMatcher<Node>(Cell.class) {
        @Override
        protected boolean matchesSafely(Node item) {
            return contentsMatcher.matches(((Cell) item).getItem());
        }

        @Override
        public void describeTo(Description description) {
            description.appendText(Cell.class.getSimpleName())
                    .appendText(" ")
                    .appendText("with value")
                    .appendDescriptionOf(contentsMatcher);
        }
    };
}
 
开发者ID:republique-et-canton-de-geneve,项目名称:chvote-1-0,代码行数:18,代码来源:AdditionalTableViewMatchers.java

示例8: marathon_select

import javafx.scene.control.Cell; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public boolean marathon_select(String value) {
    TextInputControl tc = (TextInputControl) getComponent();
    Boolean isCellEditor = (Boolean) tc.getProperties().get("marathon.celleditor");
    tc.setText("");
    if (isCellEditor != null && isCellEditor) {
        super.sendKeys(value, JavaAgentKeys.ENTER);
        Cell cell = (Cell) tc.getProperties().get("marathon.cell");
        cell.commitEdit(value);
    } else {
        super.sendKeys(value);
    }
    return true;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:JavaFXTextInputControlElement.java

示例9: createChoiceBox

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> ChoiceBox<T> createChoiceBox(
        final Cell<T> cell,
        final ObservableList<T> items,
        final ObjectProperty<StringConverter<T>> converter
) {
    final ChoiceBox<T> choiceBox = new ChoiceBox<>(items);
    choiceBox.setMaxWidth(Double.MAX_VALUE);
    choiceBox.converterProperty().bind(converter);
    choiceBox.getSelectionModel().selectedItemProperty().addListener((ov, oldValue, newValue) -> {
        if (cell.isEditing()) {
            cell.commitEdit(newValue);
        }
    });
    return choiceBox;
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:16,代码来源:CellUtils.java

示例10: createComboBox

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> ComboBox<T> createComboBox(final Cell<T> cell,
        final ObservableList<T> items,
        final ObjectProperty<StringConverter<T>> converter
) {
    final ComboBox<T> comboBox = new ComboBox<>(items);
    comboBox.converterProperty().bind(converter);
    comboBox.setMaxWidth(Double.MAX_VALUE);
    comboBox.getSelectionModel().selectedItemProperty()
            .addListener((ov, oldValue, newValue) -> {
                if (cell.isEditing()) {
                    cell.commitEdit(newValue);
                }
            });
    return comboBox;
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:16,代码来源:CellUtils.java

示例11: setCellStyle

import javafx.scene.control.Cell; //导入依赖的package包/类
/** Set style of table cell to reflect optional background color
 * @param cell
 *  @param row Table row
 *  @param col Table column
 */
private void setCellStyle(Cell<String> cell, final int row, final int col)
{
    final Color color = getCellColor(row, col);
    if (color == null)
        cell.setStyle(null);
    else
    {   // Based on modena.css
        // .table-cell has no -fx-background-color to see overall background,
        // but .table-cell:selected uses this to get border with an inset color
        cell.setStyle("-fx-background-color: -fx-table-cell-border-color, " + JFXUtil.webRGB(color) +
                      ";-fx-background-insets: 0, 0 0 1 0;");
    }
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:19,代码来源:StringTable.java

示例12: testGetCellAdjuster

import javafx.scene.control.Cell; //导入依赖的package包/类
@Test
public void testGetCellAdjuster() {
	Adjuster adjuster = Adjuster.getAdjuster(Cell.class);
	
	assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
	assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
 
开发者ID:yumix,项目名称:javafx-dpi-scaling,代码行数:8,代码来源:AdjusterTest.java

示例13: updateItem

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> void updateItem(final Cell<T> cell,
        final StringConverter<T> converter,
        final HBox hbox,
        final Node graphic,
        final TextField textField)
{
    if (cell.isEmpty())
    {
        cell.setText(null);
        cell.setGraphic(null);
    } else
    {
        if (cell.isEditing())
        {
            if (textField != null)
            {
                textField.setText(getItemText(cell, converter));
            }
            cell.setText(null);

            if (graphic != null)
            {
                hbox.getChildren().setAll(graphic, textField);
                cell.setGraphic(hbox);
            } else
            {
                cell.setGraphic(textField);
            }
        } else
        {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:36,代码来源:CustomTableCell.java

示例14: startEdit

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> void startEdit(final Cell<T> cell,
        final StringConverter<T> converter,
        final HBox hbox,
        final Node graphic,
        final TextField textField)
{
    if (textField != null)
    {
        textField.setText(getItemText(cell, converter));
    }
    cell.setText(null);

    if (graphic != null)
    {
        hbox.getChildren().setAll(graphic, textField);
        cell.setGraphic(hbox);
    } else
    {
        cell.setGraphic(textField);
    }

    textField.selectAll();

    // requesting focus so that key input can immediately go into the
    // TextField (see RT-28132)
    textField.requestFocus();
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:28,代码来源:CustomTableCell.java

示例15: getItemText

import javafx.scene.control.Cell; //导入依赖的package包/类
private static <T> String getItemText(Cell<T> cell, StringConverter<T> converter) {
    return converter == null
            ? cell.getItem() == null ? "" : cell.getItem().toString()
            : converter.toString(cell.getItem());
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:6,代码来源:CellUtils.java


注:本文中的javafx.scene.control.Cell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。