本文整理汇总了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));
}
示例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;
}
示例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;
}
示例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();
}