本文整理匯總了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();
}