public SearchBox() {
setId("SearchBox");
getStyleClass().add("search-box");
setMinHeight(24);
setPrefSize(200, 24);
setMaxSize(Control.USE_PREF_SIZE, Control.USE_PREF_SIZE);
textBox = new TextField();
textBox.setPromptText("Search");
clearButton = new Button();
clearButton.setVisible(false);
getChildren().addAll(textBox, clearButton);
clearButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionEvent) {
textBox.setText("");
textBox.requestFocus();
}
});
textBox.textProperty().addListener(new ChangeListener<String>() {
@Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
clearButton.setVisible(textBox.getText().length() != 0);
}
});
}
java类javafx.scene.control.TextField的实例源码
SearchBoxSample.java 文件源码
项目:marathonv5
阅读 33
收藏 0
点赞 0
评论 0
MovieViewSkin.java 文件源码
项目:ExtremeGuiMakeover
阅读 39
收藏 0
点赞 0
评论 0
private void addToolBar() {
TextField textField = new TextField();
textField.getStyleClass().add("search-field");
textField.textProperty().bindBidirectional(getSkinnable().filterTextProperty());
Text clearIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.TIMES_CIRCLE, "18");
CustomTextField customTextField = new CustomTextField();
customTextField.getStyleClass().add("search-field");
customTextField.setLeft(FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.SEARCH, "18px"));
customTextField.setRight(clearIcon);
customTextField.textProperty().bindBidirectional(getSkinnable().filterTextProperty());
clearIcon.setOnMouseClicked(evt -> customTextField.setText(""));
FlipPanel searchFlipPanel = new FlipPanel();
searchFlipPanel.setFlipDirection(Orientation.HORIZONTAL);
searchFlipPanel.getFront().getChildren().add(textField);
searchFlipPanel.getBack().getChildren().add(customTextField);
searchFlipPanel.visibleProperty().bind(getSkinnable().enableSortingAndFilteringProperty());
getSkinnable().useControlsFXProperty().addListener(it -> {
if (getSkinnable().isUseControlsFX()) {
searchFlipPanel.flipToBack();
} else {
searchFlipPanel.flipToFront();
}
});
showTrailerButton = new Button("Show Trailer");
showTrailerButton.getStyleClass().add("trailer-button");
showTrailerButton.setMaxHeight(Double.MAX_VALUE);
showTrailerButton.setOnAction(evt -> showTrailer());
BorderPane toolBar = new BorderPane();
toolBar.setLeft(showTrailerButton);
toolBar.setRight(searchFlipPanel);
toolBar.getStyleClass().add("movie-toolbar");
container.add(toolBar, 1, 0);
}
OptionsController.java 文件源码
项目:CSS-Editor-FX
阅读 52
收藏 0
点赞 0
评论 0
private void createField() {
field = new TextField(getString());
field.setEditable(false);
field.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
if (e.getCode() == KeyCode.ENTER) {
try {
commitEdit(KeyCombination.valueOf(field.getText()));
} catch (Exception ee) {
cancelEdit();
}
} else if (e.getCode() == KeyCode.ESCAPE) {
cancelEdit();
} else {
field.setText(convert(e).toString());
}
e.consume();
});
}
TDATableFilter.java 文件源码
项目:CDN-FX-2.2
阅读 36
收藏 0
点赞 0
评论 0
public static SortedList<Ticket> createTableFilter(TextField textSearch, ListView listView){
if(isPrepared)
return new SortedList<>(filteredTickets);
textSearch.setOnKeyPressed((KeyEvent ke) ->{
if(ke.getCode().equals(KeyCode.ENTER)){
text = textSearch.getText().toLowerCase();
filterTickets();
}
});
//Listview
listView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
categoryText = newValue.split(" ")[0];
if(categoryText.equals("DownloadPlayChild"))
categoryText = "DLP";
filterTickets();
}
});
isPrepared = true;
return new SortedList<>(filteredTickets);
}
EntityGuiController.java 文件源码
项目:SensorThingsManager
阅读 45
收藏 0
点赞 0
评论 0
@Override
public void init(SensorThingsService service, Observation entity, GridPane gridProperties, Accordion accordionLinks, Label labelId, boolean editable) {
this.labelId = labelId;
this.entity = entity;
int i = 0;
textPhenomenonTime = addFieldTo(gridProperties, i, "PhenomenonTime", new TextField(), false, editable);
textResultTime = addFieldTo(gridProperties, ++i, "ResultTime", new TextField(), false, editable);
textResult = addFieldTo(gridProperties, ++i, "Result", new TextArea(), true, editable);
textResultQuality = addFieldTo(gridProperties, ++i, "ResultQuality", new TextField(), false, editable);
textValidTime = addFieldTo(gridProperties, ++i, "ValidTime", new TextField(), false, editable);
textParameters = addFieldTo(gridProperties, ++i, "Parameters", new TextArea(), true, editable);
if (accordionLinks != null) {
try {
accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getDatastream(), service.datastreams().query(), entity::setDatastream));
accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getMultiDatastream(), service.multiDatastreams().query(), entity::setMultiDatastream));
accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getFeatureOfInterest(), service.featuresOfInterest().query(), entity::setFeatureOfInterest));
} catch (IOException | ServiceFailureException ex) {
LOGGER.error("Failed to create panel.", ex);
}
}
}
MainController.java 文件源码
项目:WholesomeChat
阅读 48
收藏 0
点赞 0
评论 0
public void initialize(URL location, ResourceBundle resources) {
gson = new Gson();
timer = new ReschedulableTimer();
runnable = new Runnable() {
public void run() {
Scene scene = stage.getScene();
TextField inputTextField = (TextField) scene.lookup("#textfield");
if (inputTextField.getText().trim().length() != 0) {
JsonObject str = new JsonObject();
str.addProperty("text", inputTextField.getText().trim());
str.addProperty("intent", "precheck");
chatAccess.send(gson.toJson(str));
}
}
};
}
RulePane.java 文件源码
项目:Conan
阅读 36
收藏 0
点赞 0
评论 0
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));
}
MainStage.java 文件源码
项目:SystemMonitorJFX
阅读 39
收藏 0
点赞 0
评论 0
private void initTableContextMenu() {
TextField textField = new TextField("Type Something"); // we will add a popup menu to this text field
contextMenu = new ContextMenu();
MenuItem pauseP = new MenuItem("Stop process");
pauseP.setId("pausep");
MenuItem continueP = new MenuItem("Continue process");
continueP.setId("continuep");
MenuItem killP = new MenuItem("Kill process");
killP.setId("killp");
pauseP.setOnAction(actionEventHandler);
continueP.setOnAction(actionEventHandler);
killP.setOnAction(actionEventHandler);
contextMenu.getItems().addAll(pauseP, continueP, new SeparatorMenuItem(), killP);
// ...
textField.setContextMenu(contextMenu);
}
TestFacebook.java 文件源码
项目:GameAuthoringEnvironment
阅读 34
收藏 0
点赞 0
评论 0
private Node makeMyHighScorePost () {
HBox box = new HBox(5);
TextField field = new TextField("Game name");
ComboBox<ScoreOrder> combo = new ComboBox<>();
for (ScoreOrder s : ScoreOrder.values()) {
combo.getItems().add(s);
}
box.getChildren().addAll(field, combo);
Button button = new Button("Post about my scores");
button.setOnMouseClicked(e -> {
myUser = mySocial.getActiveUser();
myUser.getProfiles().getActiveProfile().highScorePost(mySocial.getHighScoreBoard(),
field.getText(),
myUser,
combo.getValue());
});
box.getChildren().add(button);
return box;
}
SearchBoxSample.java 文件源码
项目:marathonv5
阅读 39
收藏 0
点赞 0
评论 0
public SearchBox() {
setId("SearchBox");
getStyleClass().add("search-box");
setMinHeight(24);
setPrefSize(200, 24);
setMaxSize(Control.USE_PREF_SIZE, Control.USE_PREF_SIZE);
textBox = new TextField();
textBox.setPromptText("Search");
clearButton = new Button();
clearButton.setVisible(false);
getChildren().addAll(textBox, clearButton);
clearButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionEvent) {
textBox.setText("");
textBox.requestFocus();
}
});
textBox.textProperty().addListener(new ChangeListener<String>() {
@Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
clearButton.setVisible(textBox.getText().length() != 0);
}
});
}
RFXTextFieldTest.java 文件源码
项目:marathonv5
阅读 32
收藏 0
点赞 0
评论 0
@Test public void getText() {
final TextField textField = (TextField) getPrimaryStage().getScene().getRoot().lookup(".text-field");
LoggingRecorder lr = new LoggingRecorder();
List<Object> text = new ArrayList<>();
Platform.runLater(() -> {
RFXComponent rTextField = new RFXTextInputControl(textField, null, null, lr);
textField.setText("Hello World");
rTextField.focusLost(null);
text.add(rTextField.getAttribute("text"));
});
new Wait("Waiting for text field text.") {
@Override public boolean until() {
return text.size() > 0;
}
};
AssertJUnit.assertEquals("Hello World", text.get(0));
}
GradientSlider.java 文件源码
项目:fxexperience2
阅读 57
收藏 0
点赞 0
评论 0
private void incOrDecFieldValue(KeyEvent e, double x) {
if (!(e.getSource() instanceof TextField)) {
return; // check it's a textField
} // increment or decrement the value
final TextField tf = (TextField) e.getSource();
final Double newValue = Double.valueOf(tf.getText()) + x;
double rounded = round(newValue, roundingFactor);
slider_slider.setValue(rounded);
tf.setText(Double.toString(newValue));
// Avoid using runLater
// This should be done somewhere else (need to investigate)
// Platform.runLater(new Runnable() {
// @Override
// public void run() {
// // position caret after new value for easy editing
// tf.positionCaret(tf.getText().length());
// }
// });
}
SceneFormController.java 文件源码
项目:Balda
阅读 42
收藏 0
点赞 0
评论 0
/**
* Добавляем текстовые поля для ввода
*/
private void addLetterTextFields() {
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
if (game[row][col] == ' ' && ((row > 0 && game[row - 1][col] != ' ')
|| (col > 0 && game[row][col - 1] != ' ')
|| (row < rows - 1 && game[row + 1][col] != ' ')
|| (col < cols - 1 && game[row][col + 1] != ' '))) {
if (gameCells[row][col] == null) {
TextField tf = new TextField();
tf.setFont(textPrototype.getFont());
gameField.add(tf, col, row);
gameCells[row][col] = tf;
} else {
// Очищаем если уже есть
gameCells[row][col].setText("");
}
}
}
}
}
JavaFXSpinnerElement.java 文件源码
项目:marathonv5
阅读 37
收藏 0
点赞 0
评论 0
@SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) {
Spinner<?> spinner = (Spinner<?>) getComponent();
if (!spinner.isEditable()) {
@SuppressWarnings("rawtypes")
SpinnerValueFactory factory = ((Spinner<?>) getComponent()).getValueFactory();
Object convertedValue = factory.getConverter().fromString(value);
factory.setValue(convertedValue);
return true;
}
TextField spinnerEditor = spinner.getEditor();
if (spinnerEditor == null) {
throw new JavaAgentException("Null value returned by getEditor() on spinner", null);
}
IJavaFXElement ele = JavaFXElementFactory.createElement(spinnerEditor, driver, window);
spinnerEditor.getProperties().put("marathon.celleditor", true);
ele.marathon_select(value);
return true;
}
SaveAsEditorDialog.java 文件源码
项目:jmonkeybuilder
阅读 34
收藏 0
点赞 0
评论 0
/**
* Handle the new selected item.
*
* @param newValue the new selected item.
*/
@FXThread
protected void processSelection(@Nullable final TreeItem<ResourceElement> newValue) {
if (newValue != null) {
final TextField fileNameField = getFileNameField();
final ResourceElement value = newValue.getValue();
final Path file = value.getFile();
if (!Files.isDirectory(file)) {
fileNameField.setText(FileUtils.getNameWithoutExtension(file));
}
}
validateFileName();
}
StringPropertyControl.java 文件源码
项目:jmonkeybuilder
阅读 40
收藏 0
点赞 0
评论 0
/**
* Update the value.
*/
@FXThread
private void updateValue(@NotNull final KeyEvent event) {
if (isIgnoreListener() || event.getCode() != KeyCode.ENTER) return;
final TextField valueField = getValueField();
final String oldValue = getPropertyValue();
final String newValue = valueField.getText();
changed(newValue, oldValue);
}
SettingsDialog.java 文件源码
项目:jmonkeybuilder
阅读 45
收藏 0
点赞 0
评论 0
/**
* Create the classes folder control.
*/
@FXThread
private void createClassesFolderControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_USER_CLASSES_FOLDER_LABEL + ":");
final HBox fieldContainer = new HBox();
classesFolderField = new TextField();
classesFolderField.setEditable(false);
classesFolderField.prefWidthProperty().bind(root.widthProperty());
final Button addButton = new Button();
addButton.setGraphic(new ImageView(Icons.ADD_12));
addButton.setOnAction(event -> processAddClassesFolder());
final Button removeButton = new Button();
removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
removeButton.setOnAction(event -> processRemoveClassesFolder());
removeButton.disableProperty().bind(classesFolderField.textProperty().isEmpty());
FXUtils.addToPane(label, fieldContainer, container);
FXUtils.addToPane(classesFolderField, addButton, removeButton, fieldContainer);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(classesFolderField, CSSClasses.TRANSPARENT_TEXT_FIELD);
FXUtils.addClassTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(classesFolderField, fieldContainer, CSSClasses.SETTINGS_DIALOG_FIELD);
FXUtils.addClassesTo(addButton, removeButton, CSSClasses.FLAT_BUTTON,
CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);
DynamicIconSupport.addSupport(addButton, removeButton);
}
FloatArrayPropertyControl.java 文件源码
项目:jmonkeybuilder
阅读 40
收藏 0
点赞 0
评论 0
@Override
@FXThread
protected void createComponents(@NotNull final HBox container) {
super.createComponents(container);
valueField = new TextField();
valueField.setOnKeyReleased(this::updateValue);
valueField.prefWidthProperty()
.bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT));
FXUtils.addClassTo(valueField, CSSClasses.ABSTRACT_PARAM_CONTROL_COMBO_BOX);
FXUtils.addToPane(valueField, container);
}
UserListView.java 文件源码
项目:Lernkartei_2017
阅读 31
收藏 0
点赞 0
评论 0
@Override
public Parent constructContainer()
{
bp.setId("loginviewbg");
list = new ListView<String>();
items = FXCollections.observableArrayList("Philippe Kr�ttli","Irina Deck","Javier Martinez Alvarez","Frithjof Hoppe");
list.setItems(items);
AllFields = new VBox(50);
AllFields.setAlignment(Pos.CENTER);
AllFields.setMaxWidth(300);
AllFields.setPadding(new Insets(20));
SearchUser = new HBox();
Bottom = new HBox();
txtUserName = new TextField();
txtUserName.setMinHeight(50);
txtUserName.setMinWidth(700);
txtUserName.setPromptText("Email-Adresse des Benutzers");
btnSearch = new AppButton("Suchen");
btnAdd = new AppButton("Hinzuf�gen");
back = new BackButton(getFXController(),"Zur�ck");
SearchUser.getChildren().addAll(txtUserName,btnSearch);
Bottom.getChildren().addAll(back,btnAdd);
AllFields.getChildren().addAll(SearchUser,list,Bottom);
bp.setLeft(AllFields);
//btnSearch.setOnAction(e -> getFXController().showView("userlist"));
return bp;
}
FormUtils.java 文件源码
项目:drd
阅读 43
收藏 0
点赞 0
评论 0
public static void initTextFormater(TextField textField, MaxActValue maxActValue) {
textField.setTextFormatter(new TextFormatter<>(new NumberStringConverter()));
textField.setTextFormatter(new TextFormatter<>(new NumberStringConverter(), null,
FormUtils.integerFilter(
maxActValue.getMinValue().intValue(),
maxActValue.getMaxValue().intValue()
)));
textField.textProperty().bindBidirectional(maxActValue.actValueProperty(), new NumberStringConverter());
}
ColorPickerComponent.java 文件源码
项目:fx-animation-editor
阅读 38
收藏 0
点赞 0
评论 0
private void addWithLabelOverlaid(String labelText, TextField textField) {
Label label = new Label(labelText);
label.setMouseTransparent(true);
StackPane.setAlignment(label, Pos.CENTER_LEFT);
StackPane container = new StackPane(textField, label);
rgbBox.getChildren().add(container);
}
Impl.java 文件源码
项目:phone-simulator
阅读 38
收藏 0
点赞 0
评论 0
void showData(ComboBox<EnumeratedBase> cboChanel, ComboBox<String> cboRole, TextField txtLocalHost, TextField txtLocalPort, TextField txtRemoteHost, TextField txtRemotePort, TextField txtPhone) {
addCboChanel(cboChanel);
cboRole.getItems().addAll("Client", "Server");
setCboRole(cboRole);
txtLocalHost.setText(m3ua.getSctpLocalHost());
txtLocalPort.setText(m3ua.getSctpLocalPort() + "");
txtRemoteHost.setText(m3ua.getSctpRemoteHost());
txtRemotePort.setText(m3ua.getSctpRemotePort() + "");
txtPhone.setText(host.getMapMan().getOrigReference());
}
IoVariableDefinitionPane.java 文件源码
项目:stvs
阅读 28
收藏 0
点赞 0
评论 0
/**
* Creates an instance with given default values to display.
* @param initialCategory Default category
* @param initialName Default name
* @param initialType Default type
*/
public IoVariableDefinitionPane(VariableCategory initialCategory, VariableRole initialRole, String initialName,
String initialType) {
super();
setVgap(10);
setHgap(10);
this.categoryComboBox = new ComboBox<>(
FXCollections.observableArrayList(VariableCategory.values()));
this.variableRoleComboBox = new ComboBox<>(
FXCollections.observableArrayList(VariableRole.values()));
this.nameTextField = new TextField(initialName);
this.typeTextField = new TextField(initialType);
categoryComboBox.valueProperty().set(initialCategory);
add(new Label("category: "), 0, 0);
add(new Label("verification-role: "), 0, 1);
add(new Label("name: "), 0, 2);
add(new Label("type: "), 0, 3);
add(categoryComboBox, 1, 0);
add(variableRoleComboBox, 1, 1);
add(nameTextField, 1, 2);
add(typeTextField, 1, 3);
ViewUtils.setupClass(this);
}
IntArrayPropertyControl.java 文件源码
项目:jmonkeybuilder
阅读 34
收藏 0
点赞 0
评论 0
@Override
@FXThread
protected void createComponents(@NotNull final HBox container) {
super.createComponents(container);
valueField = new TextField();
valueField.setOnKeyReleased(this::updateValue);
valueField.prefWidthProperty()
.bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT));
FXUtils.addClassTo(valueField, CSSClasses.ABSTRACT_PARAM_CONTROL_COMBO_BOX);
FXUtils.addToPane(valueField, container);
}
CategoryFragment.java 文件源码
项目:Notebook
阅读 46
收藏 0
点赞 0
评论 0
private void createDialog(Category listItem) {
List<Category> categories = CategoryDao.getInstance().findAll();
AlertDialog.Builder builder = new AlertDialog.Builder();
builder.title("���༭");
builder.view("dialog_category_edit")
.build();
alertDialog = builder.build();
Button btn_confirm = alertDialog.findView("#btn_confirm", Button.class);
Button btn_cancel = alertDialog.findView("#btn_cancel", Button.class);
TextField et_title = alertDialog.findView("#et_title", TextField.class);
if(listItem.getName() != null) et_title.setText(listItem.getName());
btn_confirm.setOnAction(ee ->{
String name = et_title.getText();
if(name.equals("")){
DialogHelper.alert("Error", "���ݲ���Ϊ�գ�");
return;
}
// update ListView items & database
listItem.setName(name);
CategoryDao.getInstance().saveOrUpdate(listItem);
// �Զ�ˢ��
loadData();
alertDialog.close();
});
btn_cancel.setOnAction(eee->{
alertDialog.close();
});
alertDialog.show();
}
WebViewBrowser.java 文件源码
项目:incubator-netbeans
阅读 44
收藏 0
点赞 0
评论 0
public WebViewPane() {
VBox.setVgrow(this, Priority.ALWAYS);
setMaxWidth(Double.MAX_VALUE);
setMaxHeight(Double.MAX_VALUE);
WebView view = new WebView();
view.setMinSize(500, 400);
view.setPrefSize(500, 400);
final WebEngine eng = view.getEngine();
eng.load("http://www.oracle.com/us/index.html");
final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
locationField.setMaxHeight(Double.MAX_VALUE);
Button goButton = new Button("Go");
goButton.setDefaultButton(true);
EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
"http://" + locationField.getText());
}
};
goButton.setOnAction(goAction);
locationField.setOnAction(goAction);
eng.locationProperty().addListener(new ChangeListener<String>() {
@Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
locationField.setText(newValue);
}
});
GridPane grid = new GridPane();
grid.setVgap(5);
grid.setHgap(5);
GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
GridPane.setConstraints(goButton,1,0);
GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
grid.getColumnConstraints().addAll(
new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
);
grid.getChildren().addAll(locationField, goButton, view);
getChildren().add(grid);
}
TabView.java 文件源码
项目:UDE
阅读 52
收藏 0
点赞 0
评论 0
protected void setTabView(String path, TilePane tP, TextField tF) {
this.tilePane = tP;
this.txtDirPath = tF;
tilePane.getChildren().clear();
txtDirPath.setText(path);
generateIcons();
}
BitcoinAddressValidator.java 文件源码
项目:creacoinj
阅读 41
收藏 0
点赞 0
评论 0
public BitcoinAddressValidator(NetworkParameters params, TextField field, Node... nodes) {
this.params = params;
this.nodes = nodes;
// Handle the red highlighting, but don't highlight in red just when the field is empty because that makes
// the example/prompt address hard to read.
new TextFieldValidator(field, text -> text.isEmpty() || testAddr(text));
// However we do want the buttons to be disabled when empty so we apply a different test there.
field.textProperty().addListener((observableValue, prev, current) -> {
toggleButtons(current);
});
toggleButtons(field.getText());
}
BitcoinAddressValidator.java 文件源码
项目:legendary-guide
阅读 45
收藏 0
点赞 0
评论 0
public BitcoinAddressValidator(NetworkParameters params, TextField field, Node... nodes) {
this.params = params;
this.nodes = nodes;
// Handle the red highlighting, but don't highlight in red just when the field is empty because that makes
// the example/prompt address hard to read.
new TextFieldValidator(field, text -> text.isEmpty() || testAddr(text));
// However we do want the buttons to be disabled when empty so we apply a different test there.
field.textProperty().addListener((observableValue, prev, current) -> {
toggleButtons(current);
});
toggleButtons(field.getText());
}
ViewUtil.java 文件源码
项目:Conan
阅读 43
收藏 0
点赞 0
评论 0
public static void addFocusListener(TextField tf, ProofView pv) {
tf.focusedProperty().addListener((observable, oldValue, newValue) -> {
pv.lastFocusedTf = tf;
pv.caretPosition = tf.getCaretPosition();
pv.updateStatus();
});
}