本文整理汇总了Java中javafx.scene.control.TextField.setDisable方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setDisable方法的具体用法?Java TextField.setDisable怎么用?Java TextField.setDisable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TextField
的用法示例。
在下文中一共展示了TextField.setDisable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WizardUneditableStringPage
import javafx.scene.control.TextField; //导入方法依赖的package包/类
public WizardUneditableStringPage(String title, String description,
StringProperty uneditableText) {
super(title);
TextField uneditableTextField = new TextField();
uneditableTextField.textProperty().bind(uneditableText);
Label descriptionLabel = new Label(description);
descriptionLabel.setWrapText(true);
descriptionLabel.setTextAlignment(TextAlignment.JUSTIFY);
this.getChildren().addAll(descriptionLabel, uneditableTextField);
uneditableTextField.setDisable(true);
}
示例2: loadPropertyCreator
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void loadPropertyCreator(){
nameField = new TextField();
nameField.setPrefWidth(150);
valField = new TextField();
valField.setPrefWidth(150);
valField.setDisable(true);
final ComboBox<Property.Type> typeBox = new ComboBox<Property.Type>();
typeBox.setPrefWidth(150);
typeBox.getItems().addAll(Property.Type.values());
final Button save = new Button("Save"), cancel = new Button("Cancel");
save.setDisable(true);
nameField.textProperty().addListener((observable, oldValue, newValue)->{
if(valField.isDisabled() && !newValue.equals(""))
valField.setDisable(false);
});
valField.textProperty().addListener((observable, oldValue, newValue)->{
if(!valField.getText().equals(""))
save.setDisable(false);
else save.setDisable(true);
});
save.setOnAction((e)->{
String newVal = valField.getText();
String keyName = nameField.getText();
Property.Type t = typeBox.getValue();
System.out.println(t);
System.out.println(newVal);
cProp = new Property(keyName, t);
if(!newProp(cProp, newVal))
FlashFXUtils.showErrorDialog(this, "Error", "Value is incompatible with property type");
else close();
});
cancel.setOnAction((e)->{
cProp = null;
close();
});
VBox viewerNode = new VBox();
viewerNode.getChildren().addAll(nameField, valField, typeBox);
viewerNode.setSpacing(10);
viewerNode.setAlignment(Pos.CENTER);
viewerNode.setPadding(new Insets(10, 10, 10, 10));
HBox buttonNode = new HBox();
buttonNode.getChildren().addAll(save, cancel);
buttonNode.setSpacing(10);
buttonNode.setAlignment(Pos.CENTER_RIGHT);
buttonNode.setPadding(new Insets(0, 5, 5, 0));
BorderPane pane = new BorderPane();
pane.setBottom(buttonNode);
pane.setCenter(viewerNode);
setScene(new Scene(pane, 200, 200));
}