use of javafx.scene.control.TextField in project uPMT by coco35700.
the class MomentExpVBox method editNameMode.
private void editNameMode() {
TextField t = new TextField();
t.setMaxWidth(180);
t.setText(moment.getName());
t.requestFocus();
ChangeListener<Boolean> listener = new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
if (!newPropertyValue) {
RenameMomentCommand cmd = new RenameMomentCommand(nameController, moment.getName(), t.getText(), main);
cmd.execute();
UndoCollector.INSTANCE.add(cmd);
borderPaneLabel.setCenter(label);
// borderPaneLabel.setCenter(label);
t.focusedProperty().removeListener(this);
}
}
};
t.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
t.setText(t.getText());
borderPaneLabel.setCenter(label);
// borderPaneLabel.setCenter(label);
}
if (event.getCode() == KeyCode.ESCAPE) {
borderPaneLabel.setCenter(label);
// borderPaneLabel.setCenter(label);
}
}
});
t.focusedProperty().addListener(listener);
Platform.runLater(() -> t.requestFocus());
Platform.runLater(() -> t.selectAll());
borderPaneLabel.setCenter(t);
// borderPaneLabel.setCenter(t);
}
use of javafx.scene.control.TextField in project uPMT by coco35700.
the class TypePropertyRepresentation method setLabelChangeName.
private void setLabelChangeName(HBox propertyPane2, TypePropertyRepresentation tpr) {
propertyValue.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent arg0) {
if (arg0.getClickCount() == 2) {
TextField t = new TextField(propertyValue.getText());
t.setMaxWidth(70);
t.setMinWidth(10);
ChangeListener<Boolean> listener = new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
if (!newPropertyValue) {
ChangePropertyValueCommand cmd = new ChangePropertyValueCommand(tpr, property.getValue(), t.getText(), main);
cmd.execute();
UndoCollector.INSTANCE.add(cmd);
propertyPane2.getChildren().remove(2);
propertyPane2.getChildren().add(propertyValue);
// propertyPane2.setRight(propertyValue);
}
}
};
t.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
t.setText(t.getText());
propertyPane2.getChildren().remove(2);
propertyPane2.getChildren().add(propertyValue);
// propertyPane2.setRight(propertyValue);
}
if (event.getCode() == KeyCode.ESCAPE) {
propertyPane2.getChildren().remove(2);
propertyPane2.getChildren().add(propertyValue);
// propertyPane2.setRight(propertyValue);
}
}
});
t.focusedProperty().addListener(listener);
Platform.runLater(() -> t.requestFocus());
Platform.runLater(() -> t.selectAll());
propertyPane2.getChildren().remove(2);
propertyPane2.getChildren().add(t);
// propertyPane2.setRight(t);
}
}
});
}
use of javafx.scene.control.TextField in project uPMT by coco35700.
the class InterviewTreeViewController method renameInter.
public void renameInter() {
renameInterview.setDisable(true);
TextField textField = new TextField();
textField.setText(interview.getName());
textField.setMaxWidth(100);
textField.requestFocus();
textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
if (!newPropertyValue) {
nomEntretien.setText(textField.getText());
interview.setName(textField.getText());
interviewPane.setLeft(nomEntretien);
renameInterview.setDisable(false);
}
}
});
textField.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
nomEntretien.setText(textField.getText());
interview.setName(textField.getText());
interviewPane.setLeft(nomEntretien);
renameInterview.setDisable(true);
}
if (event.getCode() == KeyCode.ESCAPE) {
interviewPane.setLeft(nomEntretien);
renameInterview.setDisable(true);
}
}
});
interviewPane.setLeft(textField);
Platform.runLater(() -> textField.requestFocus());
Platform.runLater(() -> textField.selectAll());
}
use of javafx.scene.control.TextField in project certmgr by hdecarne.
the class AbstractPeriodStringConverter method attach.
/**
* Attach this converter to a {@link ComboBox}.
*
* @param comboBox The {@link ComboBox} to attach to.
*/
public void attach(ComboBox<T> comboBox) {
comboBox.setConverter(this);
if (comboBox.isEditable()) {
TextField editor = comboBox.getEditor();
editor.focusedProperty().addListener((p, o, n) -> onFocusedChanged(editor, n));
}
}
use of javafx.scene.control.TextField in project S4T1TM2 by CSUS-CSC-131-Spring2018.
the class ProjectsScene method getScene.
@Override
public Pane getScene() {
Pane scene = new StackPane();
scene.setOpaqueInsets(new Insets(10));
Pane taskNav = new Pane();
taskNav.prefHeightProperty().bind(scene.heightProperty());
taskNav.prefWidthProperty().bind(DoubleConstant.valueOf(150));
// taskNav.setBackground(new Background(new BackgroundFill(Color.GREEN, null, null)));
scene.getChildren().add(taskNav);
TextField filterField = new JFXTextField();
filterField.layoutXProperty().bind(DoubleConstant.valueOf(0));
filterField.layoutYProperty().bind(DoubleConstant.valueOf(0));
filterField.prefWidthProperty().bind(DoubleConstant.valueOf(200));
filterField.setPromptText("Search");
taskNav.getChildren().add(filterField);
FilterableTreeItem<String> rootNode = new FilterableTreeItem<>("SAFsaf");
JFXTreeView<String> treeView = new JFXTreeView<>(rootNode);
treeView.setEditable(true);
treeView.setShowRoot(false);
rootNode.getInternalChildren().add(new FilterableTreeItem<String>("Sprint 1") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Task A") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {
{
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {
{
}
});
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Task B") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {
{
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {
{
}
});
}
});
}
});
rootNode.getInternalChildren().add(new FilterableTreeItem<String>("Sprint 2") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Task A") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {
{
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {
{
}
});
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Task B") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {
{
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {
{
}
});
}
});
}
});
rootNode.getInternalChildren().add(new FilterableTreeItem<String>("Sprint 2") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Task A") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {
{
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {
{
}
});
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Task B") {
{
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {
{
}
});
this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {
{
}
});
}
});
}
});
// treeView.prefWidthProperty().bind(DoubleConstant.valueOf(200));
treeView.layoutYProperty().bind(filterField.layoutYProperty().add(filterField.heightProperty()));
treeView.layoutXProperty().bind(DoubleConstant.valueOf(0));
treeView.prefWidthProperty().bind(DoubleConstant.valueOf(200));
treeView.prefHeightProperty().bind(taskNav.heightProperty().subtract(filterField.heightProperty()));
taskNav.getChildren().add(treeView);
// define search predicate
rootNode.predicateProperty().bind(Bindings.createObjectBinding(() -> {
// predicate is reevaluated when filterfield is modified
if (filterField.getText() == null || filterField.getText().isEmpty()) {
return null;
}
return TreeViewDemo.TreeItemPredicate.create(actor -> actor.toLowerCase().contains(filterField.getText().toLowerCase()));
}, filterField.textProperty()));
return scene;
}
Aggregations