• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Cell类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: cancelEdit

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> void cancelEdit(Cell<T> cell, final StringConverter<T> converter, Node graphic) {
    cell.setText(getItemText(cell, converter));
    cell.setGraphic(graphic);
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:5,代码来源:CellUtils.java


示例17: cancelEdit

import javafx.scene.control.Cell; //导入依赖的package包/类
static <T> void cancelEdit(Cell<T> cell, final StringConverter<T> converter, Node graphic) {
	cell.setText(getItemText(cell, converter));
	cell.setGraphic(graphic);
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:5,代码来源:PasswordTextFieldTableCell.java


示例18: 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.");
        }
        /**
         * original code:
         * cell.commitEdit(converter.fromString(textField.getText()));
         * event.consume();
         */

        try
        {
            cell.commitEdit(converter.fromString(textField.getText()));
        } catch (NumberFormatException e)
        {
            cell.cancelEdit();
        } finally
        {

            event.consume();
        }
    });
    textField.setOnKeyReleased(t ->
    {
        if (t.getCode() == KeyCode.ESCAPE)
        {
            cell.cancelEdit();
            t.consume();
        }
    });
    return textField;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:44,代码来源:CustomTableCell.java


示例19: 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:gg-net,项目名称:dwoss,代码行数:7,代码来源:CustomTableCell.java


示例20: getItemText

import javafx.scene.control.Cell; //导入依赖的package包/类
/***************************************************************************
 * * PasswordTextField convenience * *
 *
 * TextFieldTableCell클래스 참고함. reference TextFieldTableCell class.
 *
 * 2016.4.13 by [email protected]
 **************************************************************************/

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:callakrsos,项目名称:Gargoyle,代码行数:12,代码来源:PasswordTextFieldTableCell.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HiveIgnoreKeyTextOutputFormat类代码示例发布时间:2022-05-22
下一篇:
Java RowSetListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap