use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.
the class JFXNodesList method addAnimatedNode.
/**
* add node to list with a specified callback that is triggered after the node animation is finished.
* Note: this method must be called instead of getChildren().add().
*
* @param node
*/
public void addAnimatedNode(Region node, Callback<Boolean, ArrayList<KeyValue>> animationCallBack) {
// create container for the node if it's a sub nodes list
if (node instanceof JFXNodesList) {
StackPane container = new StackPane(node);
container.setPickOnBounds(false);
addAnimatedNode(container, animationCallBack);
return;
}
// init node property
node.setVisible(false);
node.minWidthProperty().bind(node.prefWidthProperty());
node.minHeightProperty().bind(node.prefHeightProperty());
if (this.getChildren().size() > 0)
initNode(node);
else {
if (node instanceof Button)
((Button) node).setOnAction((action) -> this.animateList());
else
node.setOnMouseClicked((click) -> this.animateList());
node.getStyleClass().add("trigger-node");
}
// init the list height and width
if (this.getChildren().size() == 0) {
node.setVisible(true);
this.minHeightProperty().bind(node.prefHeightProperty());
this.maxHeightProperty().bind(node.prefHeightProperty());
this.minWidthProperty().bind(node.prefWidthProperty());
this.maxWidthProperty().bind(node.prefWidthProperty());
}
// add the node and its listeners
this.getChildren().add(node);
this.rotateProperty().addListener((o, oldVal, newVal) -> node.setRotate(newVal.doubleValue() % 180 == 0 ? newVal.doubleValue() : -newVal.doubleValue()));
if (animationCallBack == null && this.getChildren().size() != 1)
animationCallBack = (expanded) -> {
return initDefaultAnimation(node, expanded);
};
else if (animationCallBack == null && this.getChildren().size() == 1)
animationCallBack = (expanded) -> {
return new ArrayList<KeyValue>();
};
animationsMap.put(node, animationCallBack);
}
use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.
the class JFXSliderSkinOLD method initialize.
private void initialize() {
isHorizontal = getSkinnable().getOrientation() == Orientation.HORIZONTAL;
thumb = new Circle();
thumb.setStrokeWidth(2);
thumb.setRadius(7);
thumb.setFill(thumbColor);
thumb.setStroke(thumbColor);
thumb.getStyleClass().setAll("thumb");
track = new Line();
track.setStroke(trackColor);
track.setStrokeWidth(3);
track.getStyleClass().setAll("track");
coloredTrack = new Line();
coloredTrack.strokeProperty().bind(thumb.strokeProperty());
coloredTrack.strokeWidthProperty().bind(track.strokeWidthProperty());
sliderValue = new Text();
sliderValue.setStroke(Color.WHITE);
sliderValue.setFont(new Font(10));
sliderValue.getStyleClass().setAll("sliderValue");
animatedThumb = new StackPane();
animatedThumb.getChildren().add(sliderValue);
getChildren().clear();
getChildren().addAll(track, coloredTrack, animatedThumb, thumb);
}
use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.
the class DoubleTextFieldEditorBuilder method createNode.
@Override
public Region createNode(Double value, DoubleBinding minWidthBinding, EventHandler<KeyEvent> keyEventsHandler, ChangeListener<Boolean> focusChangeListener) {
StackPane pane = new StackPane();
pane.setStyle("-fx-padding:-10 0 -10 0");
textField = new JFXTextField(value + "");
textField.minWidthProperty().bind(minWidthBinding);
textField.setOnKeyPressed(keyEventsHandler);
textField.focusedProperty().addListener(focusChangeListener);
DoubleValidator validator = new DoubleValidator();
validator.setMessage("Value must be a rational number");
textField.getValidators().add(validator);
pane.getChildren().add(textField);
return pane;
}
use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.
the class DatePickerDemo method start.
@Override
public void start(Stage stage) {
FlowPane main = new FlowPane();
main.setVgap(20);
main.setHgap(20);
DatePicker datePicker = new DatePicker();
main.getChildren().add(datePicker);
JFXDatePicker datePickerFX = new JFXDatePicker();
main.getChildren().add(datePickerFX);
datePickerFX.setPromptText("pick a date");
JFXTimePicker blueDatePicker = new JFXTimePicker();
blueDatePicker.setDefaultColor(Color.valueOf("#3f51b5"));
blueDatePicker.setOverLay(true);
main.getChildren().add(blueDatePicker);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(100));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 400, 700);
scene.getStylesheets().add(MainDemo.class.getResource("/resources/css/jfoenix-fonts.css").toExternalForm());
scene.getStylesheets().add(MainDemo.class.getResource("/resources/css/jfoenix-design.css").toExternalForm());
stage.setTitle("JFX Date Picker Demo");
stage.setScene(scene);
stage.show();
}
use of javafx.scene.layout.StackPane in project JFoenix by jfoenixadmin.
the class DrawerDemo method start.
@Override
public void start(Stage primaryStage) throws Exception {
FlowPane content = new FlowPane();
JFXButton leftButton = new JFXButton("LEFT");
JFXButton topButton = new JFXButton("TOP");
JFXButton rightButton = new JFXButton("RIGHT");
JFXButton bottomButton = new JFXButton("BOTTOM");
content.getChildren().addAll(leftButton, topButton, rightButton, bottomButton);
content.setMaxSize(200, 200);
JFXDrawer leftDrawer = new JFXDrawer();
StackPane leftDrawerPane = new StackPane();
leftDrawerPane.getStyleClass().add("red-400");
leftDrawerPane.getChildren().add(new JFXButton("Left Content"));
leftDrawer.setSidePane(leftDrawerPane);
leftDrawer.setDefaultDrawerSize(150);
// leftDrawer.setContent(content);
leftDrawer.setOverLayVisible(false);
leftDrawer.setResizableOnDrag(true);
JFXDrawer bottomDrawer = new JFXDrawer();
StackPane bottomDrawerPane = new StackPane();
bottomDrawerPane.getStyleClass().add("deep-purple-400");
bottomDrawerPane.getChildren().add(new JFXButton("Bottom Content"));
bottomDrawer.setDefaultDrawerSize(150);
bottomDrawer.setDirection(DrawerDirection.BOTTOM);
bottomDrawer.setSidePane(bottomDrawerPane);
// bottomDrawer.setContent(leftDrawer);
bottomDrawer.setOverLayVisible(false);
bottomDrawer.setResizableOnDrag(true);
JFXDrawer rightDrawer = new JFXDrawer();
StackPane rightDrawerPane = new StackPane();
rightDrawerPane.getStyleClass().add("blue-400");
rightDrawerPane.getChildren().add(new JFXButton("Right Content"));
rightDrawer.setDirection(DrawerDirection.RIGHT);
rightDrawer.setDefaultDrawerSize(150);
rightDrawer.setSidePane(rightDrawerPane);
// rightDrawer.setContent(bottomDrawer);
rightDrawer.setOverLayVisible(false);
rightDrawer.setResizableOnDrag(true);
JFXDrawer topDrawer = new JFXDrawer();
StackPane topDrawerPane = new StackPane();
topDrawerPane.getStyleClass().add("green-400");
topDrawerPane.getChildren().add(new JFXButton("Top Content"));
topDrawer.setDirection(DrawerDirection.TOP);
topDrawer.setDefaultDrawerSize(150);
topDrawer.setSidePane(topDrawerPane);
// topDrawer.setContent(rightDrawer);
topDrawer.setOverLayVisible(false);
topDrawer.setResizableOnDrag(true);
JFXDrawersStack drawersStack = new JFXDrawersStack();
drawersStack.setContent(content);
leftDrawer.setId("LEFT");
rightDrawer.setId("RIGHT");
bottomDrawer.setId("BOT");
topDrawer.setId("TOP");
leftButton.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
drawersStack.toggle(leftDrawer);
});
bottomButton.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
drawersStack.toggle(bottomDrawer);
});
rightButton.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
drawersStack.toggle(rightDrawer);
});
topButton.addEventHandler(MouseEvent.MOUSE_PRESSED, (e) -> {
drawersStack.toggle(topDrawer);
});
final Scene scene = new Scene(drawersStack, 800, 800);
scene.getStylesheets().add(DrawerDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
scene.getStylesheets().add(DrawerDemo.class.getResource("/resources/css/jfoenix-design.css").toExternalForm());
primaryStage.setTitle("JFX Drawer Demo");
primaryStage.setScene(scene);
primaryStage.setResizable(true);
primaryStage.show();
}
Aggregations