use of javafx.scene.layout.FlowPane in project Smartcity-Smarthouse by TechnionYP5777.
the class TempDashboard method start.
@Override
public void start(Stage stage) throws Exception {
pane = new FlowPane(Orientation.HORIZONTAL, 1, 1, textTile);
pane.setPadding(new Insets(5));
pane.setPrefSize(150, 150);
pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Dashboard Configuration in Action");
stage.setScene(scene);
stage.show();
}
use of javafx.scene.layout.FlowPane in project bitsquare by bitsquare.
the class SepaForm method addCountriesGrid.
private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList, List<Country> dataProvider) {
Label label = addLabel(gridPane, ++gridRow, title, 0);
label.setWrapText(true);
label.setMaxWidth(180);
label.setTextAlignment(TextAlignment.RIGHT);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setValignment(label, VPos.TOP);
FlowPane flowPane = new FlowPane();
flowPane.setPadding(new Insets(10, 10, 10, 10));
flowPane.setVgap(10);
flowPane.setHgap(10);
flowPane.setMinHeight(55);
if (isEditable)
flowPane.setId("flow-pane-checkboxes-bg");
else
flowPane.setId("flow-pane-checkboxes-non-editable-bg");
dataProvider.stream().forEach(country -> {
final String countryCode = country.code;
CheckBox checkBox = new CheckBox(countryCode);
checkBox.setUserData(countryCode);
checkBoxList.add(checkBox);
checkBox.setMouseTransparent(!isEditable);
checkBox.setMinWidth(45);
checkBox.setMaxWidth(45);
checkBox.setTooltip(new Tooltip(country.name));
checkBox.setOnAction(event -> {
if (checkBox.isSelected())
sepaAccount.addAcceptedCountry(countryCode);
else
sepaAccount.removeAcceptedCountry(countryCode);
updateAllInputsValid();
});
flowPane.getChildren().add(checkBox);
});
updateCountriesSelection(isEditable, checkBoxList);
GridPane.setRowIndex(flowPane, gridRow);
GridPane.setColumnIndex(flowPane, 1);
gridPane.getChildren().add(flowPane);
}
use of javafx.scene.layout.FlowPane in project JFoenix by jfoenixadmin.
the class TreeTableDemo method start.
@Override
public void start(Stage primaryStage) throws Exception {
try {
JFXTreeTableColumn<User, String> deptColumn = new JFXTreeTableColumn<>("Department");
deptColumn.setPrefWidth(150);
deptColumn.setCellValueFactory((TreeTableColumn.CellDataFeatures<User, String> param) -> {
if (deptColumn.validateValue(param))
return param.getValue().getValue().department;
else
return deptColumn.getComputedValue(param);
});
JFXTreeTableColumn<User, String> empColumn = new JFXTreeTableColumn<>("Employee");
empColumn.setPrefWidth(150);
empColumn.setCellValueFactory((TreeTableColumn.CellDataFeatures<User, String> param) -> {
if (empColumn.validateValue(param))
return param.getValue().getValue().userName;
else
return empColumn.getComputedValue(param);
});
JFXTreeTableColumn<User, String> ageColumn = new JFXTreeTableColumn<>("Age");
ageColumn.setPrefWidth(150);
ageColumn.setCellValueFactory((TreeTableColumn.CellDataFeatures<User, String> param) -> {
if (ageColumn.validateValue(param))
return param.getValue().getValue().age;
else
return ageColumn.getComputedValue(param);
});
ageColumn.setCellFactory((TreeTableColumn<User, String> param) -> new GenericEditableTreeTableCell<User, String>(new TextFieldEditorBuilder()));
ageColumn.setOnEditCommit((CellEditEvent<User, String> t) -> {
((User) t.getTreeTableView().getTreeItem(t.getTreeTablePosition().getRow()).getValue()).age.set(t.getNewValue());
});
empColumn.setCellFactory((TreeTableColumn<User, String> param) -> new GenericEditableTreeTableCell<User, String>(new TextFieldEditorBuilder()));
empColumn.setOnEditCommit((CellEditEvent<User, String> t) -> {
((User) t.getTreeTableView().getTreeItem(t.getTreeTablePosition().getRow()).getValue()).userName.set(t.getNewValue());
});
deptColumn.setCellFactory((TreeTableColumn<User, String> param) -> new GenericEditableTreeTableCell<User, String>(new TextFieldEditorBuilder()));
deptColumn.setOnEditCommit((CellEditEvent<User, String> t) -> {
((User) t.getTreeTableView().getTreeItem(t.getTreeTablePosition().getRow()).getValue()).department.set(t.getNewValue());
});
// data
ObservableList<User> users = FXCollections.observableArrayList();
users.add(new User("Computer Department", "23", "CD 1"));
users.add(new User("Sales Department", "22", "Employee 1"));
users.add(new User("Sales Department", "22", "Employee 2"));
users.add(new User("Sales Department", "25", "Employee 4"));
users.add(new User("Sales Department", "25", "Employee 5"));
users.add(new User("IT Department", "42", "ID 2"));
users.add(new User("HR Department", "22", "HR 1"));
users.add(new User("HR Department", "22", "HR 2"));
for (int i = 0; i < 40000; i++) {
users.add(new User("HR Department", i % 10 + "", "HR 2" + i));
}
for (int i = 0; i < 40000; i++) {
users.add(new User("Computer Department", i % 20 + "", "CD 2" + i));
}
for (int i = 0; i < 40000; i++) {
users.add(new User("IT Department", i % 5 + "", "HR 2" + i));
}
// build tree
final TreeItem<User> root = new RecursiveTreeItem<User>(users, RecursiveTreeObject::getChildren);
JFXTreeTableView<User> treeView = new JFXTreeTableView<User>(root);
treeView.setShowRoot(false);
treeView.setEditable(true);
treeView.getColumns().setAll(deptColumn, ageColumn, empColumn);
FlowPane main = new FlowPane();
main.setPadding(new Insets(10));
main.getChildren().add(treeView);
JFXButton groupButton = new JFXButton("Group");
groupButton.setOnAction((action) -> {
new Thread(() -> treeView.group(empColumn)).start();
});
main.getChildren().add(groupButton);
JFXButton unGroupButton = new JFXButton("unGroup");
unGroupButton.setOnAction((action) -> treeView.unGroup(empColumn));
main.getChildren().add(unGroupButton);
JFXTextField filterField = new JFXTextField();
main.getChildren().add(filterField);
Label size = new Label();
filterField.textProperty().addListener((o, oldVal, newVal) -> {
treeView.setPredicate(user -> user.getValue().age.get().contains(newVal) || user.getValue().department.get().contains(newVal) || user.getValue().userName.get().contains(newVal));
});
size.textProperty().bind(Bindings.createStringBinding(() -> treeView.getCurrentItemsCount() + "", treeView.currentItemsCountProperty()));
main.getChildren().add(size);
Scene scene = new Scene(main, 475, 500);
scene.getStylesheets().add(TreeTableDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
// ScenicView.show(scene);
} catch (Exception e) {
e.printStackTrace();
}
}
use of javafx.scene.layout.FlowPane in project JFoenix by jfoenixadmin.
the class HamburgerDemo method start.
@Override
public void start(Stage stage) {
FlowPane main = new FlowPane();
main.setVgap(20);
main.setHgap(20);
JFXHamburger h1 = new JFXHamburger();
HamburgerSlideCloseTransition burgerTask = new HamburgerSlideCloseTransition(h1);
burgerTask.setRate(-1);
h1.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
burgerTask.setRate(burgerTask.getRate() * -1);
burgerTask.play();
});
JFXHamburger h2 = new JFXHamburger();
HamburgerBasicCloseTransition burgerTask1 = new HamburgerBasicCloseTransition(h2);
burgerTask1.setRate(-1);
h2.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
burgerTask1.setRate(burgerTask1.getRate() * -1);
burgerTask1.play();
});
JFXHamburger h3 = new JFXHamburger();
HamburgerBackArrowBasicTransition burgerTask2 = new HamburgerBackArrowBasicTransition(h3);
burgerTask2.setRate(-1);
h3.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
burgerTask2.setRate(burgerTask2.getRate() * -1);
burgerTask2.play();
});
JFXHamburger h4 = new JFXHamburger();
HamburgerNextArrowBasicTransition burgerTask3 = new HamburgerNextArrowBasicTransition(h4);
burgerTask3.setRate(-1);
h4.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
burgerTask3.setRate(burgerTask3.getRate() * -1);
burgerTask3.play();
});
main.getChildren().add(h1);
main.getChildren().add(h2);
main.getChildren().add(h3);
main.getChildren().add(h4);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(60));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 400, 200);
scene.getStylesheets().add(HamburgerDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX Burgers Demo :) ");
stage.setScene(scene);
stage.setResizable(false);
stage.show();
}
use of javafx.scene.layout.FlowPane in project JFoenix by jfoenixadmin.
the class AnimationDemo method start.
@Override
public void start(Stage stage) {
FlowPane main = new FlowPane();
main.setVgap(20);
main.setHgap(20);
StackPane colorPane = new StackPane();
colorPane.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
colorPane.getStyleClass().add("red-500");
main.getChildren().add(colorPane);
StackPane colorPane1 = new StackPane();
colorPane1.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
colorPane1.getStyleClass().add("blue-500");
StackPane placeHolder = new StackPane(colorPane1);
placeHolder.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
main.getChildren().add(placeHolder);
StackPane colorPane2 = new StackPane();
colorPane2.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
colorPane2.getStyleClass().add("green-500");
main.getChildren().add(colorPane2);
StackPane colorPane3 = new StackPane();
colorPane3.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
colorPane3.getStyleClass().add("yellow-500");
main.getChildren().add(colorPane3);
StackPane colorPane4 = new StackPane();
colorPane4.setStyle("-fx-background-radius:50; -fx-min-width:50; -fx-min-height:50;");
colorPane4.getStyleClass().add("purple-500");
main.getChildren().add(colorPane4);
StackPane wizard = new StackPane();
wizard.getChildren().add(main);
StackPane.setMargin(main, new Insets(100));
wizard.setStyle("-fx-background-color:WHITE");
StackPane nextPage = new StackPane();
StackPane newPlaceHolder = new StackPane();
newPlaceHolder.setStyle("-fx-background-radius:50; -fx-max-width:50; -fx-max-height:50;");
nextPage.getChildren().add(newPlaceHolder);
StackPane.setAlignment(newPlaceHolder, Pos.TOP_LEFT);
JFXHamburger h4 = new JFXHamburger();
h4.setMaxSize(40, 40);
HamburgerBackArrowBasicTransition burgerTask3 = new HamburgerBackArrowBasicTransition(h4);
burgerTask3.setRate(-1);
h4.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
burgerTask3.setRate(burgerTask3.getRate() * -1);
burgerTask3.play();
});
nextPage.getChildren().add(h4);
StackPane.setAlignment(h4, Pos.TOP_LEFT);
StackPane.setMargin(h4, new Insets(10));
JFXNodesAnimation<FlowPane, StackPane> animation = new JFXNodesAnimation<FlowPane, StackPane>(main, nextPage) {
private Pane tempPage = new Pane();
double x = 0;
double y = 0;
@Override
public void init() {
nextPage.setOpacity(0);
wizard.getChildren().add(tempPage);
wizard.getChildren().add(nextPage);
x = colorPane1.localToScene(colorPane1.getBoundsInLocal()).getMinX();
y = colorPane1.localToScene(colorPane1.getBoundsInLocal()).getMinY();
tempPage.getChildren().add(colorPane1);
colorPane1.setTranslateX(x);
colorPane1.setTranslateY(y);
}
@Override
public void end() {
}
@Override
public Animation animateSharedNodes() {
return new Timeline();
}
@Override
public Animation animateExit() {
return new Timeline(new KeyFrame(Duration.millis(300), new KeyValue(main.opacityProperty(), 0, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(520), new KeyValue(colorPane1.translateXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(colorPane1.translateYProperty(), 0, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(200), new KeyValue(colorPane1.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(colorPane1.scaleYProperty(), 1, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(1000), new KeyValue(colorPane1.scaleXProperty(), 40, Interpolator.EASE_BOTH), new KeyValue(colorPane1.scaleYProperty(), 40, Interpolator.EASE_BOTH)));
}
@Override
public Animation animateEntrance() {
return new Timeline(new KeyFrame(Duration.millis(320), new KeyValue(nextPage.opacityProperty(), 1, Interpolator.EASE_BOTH)));
}
};
colorPane1.setOnMouseClicked((click) -> {
animation.animate();
});
// wizard.getChildren().add(nextPage);
final Scene scene = new Scene(wizard, 800, 200);
scene.getStylesheets().add(ButtonDemo.class.getResource("/resources/css/jfoenix-design.css").toExternalForm());
scene.getStylesheets().add(ButtonDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX Button Demo");
stage.setScene(scene);
stage.show();
}
Aggregations