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


Java RequiredFieldValidator类代码示例

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


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

示例1: initialize

import com.jfoenix.validation.RequiredFieldValidator; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
	api = new APIConnect();
	ValidatorBase require = new RequiredFieldValidator();
	require.setMessage("ユーザIDは必須");
	ValidatorBase validator = new UserValidator(api);
	validator.setMessage("無効なユーザID");
	userField.getValidators().addAll(require, validator);
	userField.focusedProperty().addListener((o, oldVal, newVal)->{
		if(!newVal) userField.validate();
		setProblem();
	});
	postedCode.getEngine().load(getClass().getResource("/resources/html/ace.html").toExternalForm());
	obj = (JSObject) postedCode.getEngine().executeScript("window");
	try {
		contest.getItems().addAll(api.getContests());
	}catch(Exception e) {
		getAlert(e, "コンテスト情報の取得に失敗しました。").show();
	}
}
 
开发者ID:skht777,项目名称:atcoder-code,代码行数:21,代码来源:MainController.java

示例2: addString

import com.jfoenix.validation.RequiredFieldValidator; //导入依赖的package包/类
/**
 * Add a simple String to a wizard step.
 *
 * @param fieldName
 * @param defaultValue
 *            the default String the textfield will contains.
 * @param prompt
 *            the text to show on the textfield prompt String.
 * @param isRequired
 *            set the field required to continue
 * @return
 */
@SuppressWarnings("unchecked")
public WizardStepBuilder addString(final String fieldName, final String defaultValue, final String prompt,
        final boolean isRequired)
{
    final JFXTextField text = new JFXTextField();
    text.setPromptText(prompt);
    if (isRequired)
    {
        final RequiredFieldValidator validator = new RequiredFieldValidator();
        validator.setMessage(Translation.LANG.getTranslation("wizard.error.input_required"));
        validator.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em")
                .styleClass("error").build());
        text.getValidators().add(validator);
    }
    text.focusedProperty().addListener((o, oldVal, newVal) ->
    {
        if (!newVal)
            text.validate();
    });
    text.setText(defaultValue);
    this.current.getData().put(fieldName, new SimpleStringProperty());
    this.current.getData().get(fieldName).bind(text.textProperty());
    this.current.addToValidate(text);

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(text, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);
    this.current.add(text, 1, this.current.getData().size() - 1);
    return this;
}
 
开发者ID:Leviathan-Studio,项目名称:MineIDE,代码行数:44,代码来源:WizardStepBuilder.java

示例3: folderValidator

import com.jfoenix.validation.RequiredFieldValidator; //导入依赖的package包/类
private void folderValidator() {
    RequiredFieldValidator requiredFieldValidator = new RequiredFieldValidator();
    selectFolderFld.getValidators().add(requiredFieldValidator);
    requiredFieldValidator.setMessage("Please select destination folder");
    selectFolderFld.focusedProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue) {
            selectFolderFld.validate();
        }
    });
    selectFolderFld.textProperty().addListener((observable, oldValue, newValue) -> selectFolderFld.validate());
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:12,代码来源:EndFileController.java

示例4: start

import com.jfoenix.validation.RequiredFieldValidator; //导入依赖的package包/类
@Override
public void start(Stage stage) {

    VBox main = new VBox();
    main.setSpacing(50);

    TextArea javafxTextArea = new TextArea();
    javafxTextArea.setPromptText("JavaFX Text Area");
    main.getChildren().add(javafxTextArea);
    JFXTextArea jfxTextArea = new JFXTextArea();
    jfxTextArea.setPromptText("JFoenix Text Area :D");
    jfxTextArea.setLabelFloat(true);

    RequiredFieldValidator validator = new RequiredFieldValidator();
    // NOTE adding error class to text area is causing the cursor to disapper
    validator.setMessage("Please type something!");
    validator.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class)
        .glyph(FontAwesomeIcon.WARNING)
        .size("1em")
        .styleClass("error")
        .build());
    jfxTextArea.getValidators().add(validator);
    jfxTextArea.focusedProperty().addListener((o, oldVal, newVal) -> {
        if (!newVal) {
            jfxTextArea.validate();
        }
    });


    main.getChildren().add(jfxTextArea);

    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");

    final Scene scene = new Scene(pane, 800, 600);
    scene.getStylesheets()
        .add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Button Demo");
    stage.setScene(scene);
    stage.show();

}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:45,代码来源:TextAreaDemo.java


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