Search in sources :

Example 1 with StackPane

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);
}
Also used : Button(javafx.scene.control.Button) KeyFrame(javafx.animation.KeyFrame) Status(javafx.animation.Animation.Status) Node(javafx.scene.Node) Timeline(javafx.animation.Timeline) StackPane(javafx.scene.layout.StackPane) HashMap(java.util.HashMap) VBox(javafx.scene.layout.VBox) ArrayList(java.util.ArrayList) Duration(javafx.util.Duration) Region(javafx.scene.layout.Region) Interpolator(javafx.animation.Interpolator) KeyValue(javafx.animation.KeyValue) Callback(javafx.util.Callback) Button(javafx.scene.control.Button) ArrayList(java.util.ArrayList) StackPane(javafx.scene.layout.StackPane)

Example 2 with StackPane

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);
}
Also used : Line(javafx.scene.shape.Line) Circle(javafx.scene.shape.Circle) Text(javafx.scene.text.Text) Font(javafx.scene.text.Font) StackPane(javafx.scene.layout.StackPane)

Example 3 with StackPane

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;
}
Also used : DoubleValidator(com.jfoenix.validation.DoubleValidator) JFXTextField(com.jfoenix.controls.JFXTextField) StackPane(javafx.scene.layout.StackPane)

Example 4 with StackPane

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();
}
Also used : JFXDatePicker(com.jfoenix.controls.JFXDatePicker) Insets(javafx.geometry.Insets) FlowPane(javafx.scene.layout.FlowPane) DatePicker(javafx.scene.control.DatePicker) JFXDatePicker(com.jfoenix.controls.JFXDatePicker) Scene(javafx.scene.Scene) JFXTimePicker(com.jfoenix.controls.JFXTimePicker) StackPane(javafx.scene.layout.StackPane)

Example 5 with StackPane

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();
}
Also used : JFXDrawer(com.jfoenix.controls.JFXDrawer) FlowPane(javafx.scene.layout.FlowPane) JFXButton(com.jfoenix.controls.JFXButton) JFXDrawersStack(com.jfoenix.controls.JFXDrawersStack) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Aggregations

StackPane (javafx.scene.layout.StackPane)63 Scene (javafx.scene.Scene)34 Insets (javafx.geometry.Insets)15 BorderPane (javafx.scene.layout.BorderPane)12 Label (javafx.scene.control.Label)9 Parameter (aima.gui.fx.framework.Parameter)8 SimulationPaneBuilder (aima.gui.fx.framework.SimulationPaneBuilder)8 FlowPane (javafx.scene.layout.FlowPane)8 VBox (javafx.scene.layout.VBox)6 JFXButton (com.jfoenix.controls.JFXButton)5 Group (javafx.scene.Group)5 MapPaneCtrl (aimax.osm.gui.fx.viewer.MapPaneCtrl)4 ArrayList (java.util.ArrayList)4 Platform (javafx.application.Platform)4 Node (javafx.scene.Node)4 Button (javafx.scene.control.Button)4 Color (javafx.scene.paint.Color)4 WebView (javafx.scene.web.WebView)4 JFXHamburger (com.jfoenix.controls.JFXHamburger)3 JFXTextField (com.jfoenix.controls.JFXTextField)3