當前位置: 首頁>>代碼示例>>Java>>正文


Java TextField.setId方法代碼示例

本文整理匯總了Java中javafx.scene.control.TextField.setId方法的典型用法代碼示例。如果您正苦於以下問題:Java TextField.setId方法的具體用法?Java TextField.setId怎麽用?Java TextField.setId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.TextField的用法示例。


在下文中一共展示了TextField.setId方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RulePane

import javafx.scene.control.TextField; //導入方法依賴的package包/類
public RulePane() {
    ArrayList<TextField> rulePrompts = new ArrayList<TextField>(3);
    this.setMaxWidth(340);
    TextField rule = new TextField();
    rule.getStyleClass().add("myText");
    rule.setPromptText("Rule");
    rule.setId("rightTextField");
    rule.setMaxWidth(100);
    for (int i = 0; i < 3; i++) {
        TextField temp = new TextField();
        temp.setVisible(false);
        temp.getStyleClass().add("myText");
        temp.setMaxWidth(80);
        rulePrompts.add(temp);
    }
    this.getChildren().addAll(rule, rulePrompts.get(0), rulePrompts.get(1), rulePrompts.get(2));
}
 
開發者ID:nonilole,項目名稱:Conan,代碼行數:18,代碼來源:RulePane.java

示例2: createBrowserField

import javafx.scene.control.TextField; //導入方法依賴的package包/類
private HBox createBrowserField() {
    HBox browseFieldBox = new HBox(5);
    dirField = new TextField();
    dirField.setId("DirectoryField");
    dirField.textProperty().addListener((observable, oldValue, newValue) -> updateOKButton());
    HBox.setHgrow(dirField, Priority.ALWAYS);
    Button browseButton = FXUIUtils.createButton("browse", "Browse directory", true, "Browse");
    FileSelectionHandler browserListener;
    String fileType = fileSelectionInfo.getFileType();
    if (fileType != null) {
        browserListener = new FileSelectionHandler(this,
                new ExtensionFilter(fileType, Arrays.asList(fileSelectionInfo.getExtensionFilters())), this, null,
                fileSelectionInfo.getTitle());
    } else {
        browserListener = new FileSelectionHandler(this, null, this, null, fileSelectionInfo.getTitle());
        browserListener.setMode(FileSelectionHandler.DIRECTORY_CHOOSER);
    }
    browserListener.setPreviousDir(new File(System.getProperty(Constants.PROP_PROJECT_DIR, ProjectLayout.projectDir)));
    browseButton.setOnAction(browserListener);
    Label label = createLabel("Name: ");
    label.setMinWidth(Region.USE_PREF_SIZE);
    label.setId("FileSelectedLabel");
    browseFieldBox.getChildren().addAll(label, dirField, browseButton);
    VBox.setMargin(browseFieldBox, new Insets(5, 5, 5, 5));
    return browseFieldBox;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:27,代碼來源:FileSelectionStage.java

示例3: createRubyHomeField

import javafx.scene.control.TextField; //導入方法依賴的package包/類
private HBox createRubyHomeField() {
    HBox rubyHomeBox = new HBox(5);
    rubyHomeField = new TextField();
    rubyHomeField.setId("RubyHomeField");
    rubyHomeField.setPromptText("(Bundled JRuby)");
    Label label = createLabel("Ruby Home: ");
    label.setId("RubyLabel");
    label.setMinWidth(Region.USE_PREF_SIZE);
    rubyHomeBox.getChildren().addAll(label, rubyHomeField);
    HBox.setHgrow(rubyHomeField, Priority.ALWAYS);
    return rubyHomeBox;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:13,代碼來源:RubyPathLayout.java

示例4: start

import javafx.scene.control.TextField; //導入方法依賴的package包/類
@Override
public void start(final Stage stage) throws Exception
{
    textField = new TextField();
    textField.setId("formatted");

    final MaskCharacter[] mask = MaskBuilder.newBuilder()
                                            .appendLiteral("\\")
                                            .appendDigit()
                                            .appendLiteral(",")
                                            .appendHexa()
                                            .appendLiteral(".")
                                            .appendLetter()
                                            .appendLiteral("$")
                                            .appendLetterOrDigit()
                                            .appendLiteral("!")
                                            .appendLowerCase()
                                            .appendUpperCase()
                                            .appendLiteral("U")
                                            .appendAny()
                                            .appendLiteral("^")
                                            .append(1, //
                                                    c -> (c == '-' || c == '+' || c == 'M' || c == 'P'),
                                                    c -> (c == '+' || c == 'P') ? 'P' : 'M', '_')
                                            .appendLiteral("/")
                                            .build();

    textField.setTextFormatter(new TextFormatter<>(new MaskTextFilter(textField, true, mask)));

    final Scene scene = new Scene(textField, 200, 50);
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:ben12,項目名稱:infxnity,代碼行數:34,代碼來源:MaskTextFilterTest.java


注:本文中的javafx.scene.control.TextField.setId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。