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