Java Code Examples for javafx.scene.layout.StackPane#setStyle()

The following examples show how to use javafx.scene.layout.StackPane#setStyle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageViewFrame.java    From oim-fx with MIT License 6 votes vote down vote up
private void init() {

        VBox rootVBox = new VBox();

        this.setCenter(rootVBox);
        this.setBackground("Resources/Images/Wallpaper/1.jpg");
        this.setTitle("登录");
        this.setWidth(380);
        this.setHeight(600);
        this.setRadius(10);

        StackPane buttonPane = new StackPane();
        buttonPane.setStyle("-fx-background-color:rgba(189, 158, 152, 1)");

        Image image = ImageBox.getImagePath("Resources/Images/Head/User/1.png", 40, 40);
        ImageView headImageView = new ImageView();
        headImageView.setImage(image);
        
        buttonPane.getChildren().add(headImageView);
        
        rootVBox.getChildren().add(buttonPane);
    }
 
Example 2
Source File: ChipViewDemo.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
@Override
    public void start(Stage stage) {
        JFXChipView<String> chipView = new JFXChipView<>();
        chipView.getChips().addAll("WEF", "WWW", "JD");
        chipView.getSuggestions().addAll("HELLO", "TROLL", "WFEWEF", "WEF");
        chipView.setStyle("-fx-background-color: WHITE;");

        StackPane pane = new StackPane();
        pane.getChildren().add(chipView);
        StackPane.setMargin(chipView, new Insets(100));
        pane.setStyle("-fx-background-color:GRAY;");

        final Scene scene = new Scene(pane, 500, 500);
//        scene.getStylesheets().add(TagAreaDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
        stage.setTitle("JFX Button Demo");
        stage.setScene(scene);
        stage.show();
//        ScenicView.show(scene);
    }
 
Example 3
Source File: SamplerJPro.java    From bootstrapfx with MIT License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {

    StackPane innerPane = new StackPane(new DemoTabPane());
    innerPane.setMaxWidth(1000);
    innerPane.setMaxHeight(600);
    innerPane.setStyle("-fx-background-color: #ddd; -fx-background-radius: 10;");
    StackPane outerPane = new StackPane(innerPane);
    outerPane.setStyle("-fx-background-image: url('/org/kordamp/bootstrapfx/ambient-background.jpg');" +
            "-fx-background-size: cover;");

    Scene scene = new Scene(outerPane);
    scene.getStylesheets().addAll(
        "org/kordamp/bootstrapfx/bootstrapfx.css",
        "org/kordamp/bootstrapfx/sampler.css",
        "org/kordamp/bootstrapfx/xml-highlighting.css");

    primaryStage.setTitle("BootstrapFX Sampler");
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 4
Source File: HeadImageFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void init() {
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);

	VBox topBox = new VBox();
	topBox.setPrefHeight(50);
	rootPane.setTop(topBox);

	Image image = ImageBox.getImageClassPath("/images/head/101_100.gif");

	ImageNode imageButton = new ImageNode();

	imageButton.setImage(image);
	imageButton.setImageSize(80);
	imageButton.setImageRadius(20);
	imageButton.setGray(true);
	imageButton.setEffect(new DropShadow(20, Color.BLACK));

	ImageView imageView = new ImageView();
	imageView.setImage(image);

	StackPane stackPane = new StackPane();
	stackPane.getChildren().add(imageButton);
	stackPane.setStyle("-fx-background-color:rgba(150,120,210,1)");

	rootPane.setCenter(stackPane);
}
 
Example 5
Source File: WaitIndicator.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public WaitIndicator(Stage stage) {	
  	this.stage = stage;
  	//stage = new Stage();
  	indicator = new CircularProgressIndicator();
      StackPane pane = new StackPane(indicator);
      
//stackPane.setScaleX(1.2);
//stackPane.setScaleY(1.2);

      pane.setBackground(Background.EMPTY);
      pane.setStyle(
   		   //"-fx-border-style: none; "
   		   //"-fx-background-color: #231d12; "
      			"-fx-background-color: transparent; "
      			+ 
      			"-fx-background-radius: 1px;"
   		   );
      
      Scene scene = new Scene(pane, 128, 128, true);

scene.setFill(Color.TRANSPARENT);

stage.requestFocus();
      stage.initStyle(StageStyle.TRANSPARENT);
      stage.setTitle("Circular Progress Indicator");
      stage.setScene(scene);
      stage.toFront();
      stage.show();
      
      indicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
  }
 
Example 6
Source File: CheckBoxDemo.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {

    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);

    CheckBox cb = new CheckBox("CheckBox");
    JFXCheckBox jfxCheckBox = new JFXCheckBox("JFX CheckBox");
    JFXCheckBox customJFXCheckBox = new JFXCheckBox("Custom JFX CheckBox");
    customJFXCheckBox.getStyleClass().add("custom-jfx-check-box");

    main.getChildren().add(cb);
    main.getChildren().add(jfxCheckBox);
    main.getChildren().add(customJFXCheckBox);

    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, 600, 200);
    scene.getStylesheets().add(CheckBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX CheckBox Demo ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();

}
 
Example 7
Source File: PdfDrawer.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw(Displayable displayable) {
        clear();
    if(getCanvas().getPlayVideo()) {
        VLCWindow.INSTANCE.stop();
    }
    imageView = getCanvas().getNewImageView();
    imageView.setFitWidth(getCanvas().getWidth());
    if(getCanvas().isStageView()) {
        image = Utils.getImageFromColour(QueleaProperties.get().getStageBackgroundColor());
    }
    else {
        image = ((ImageDisplayable) displayable).getImage();
        imageView.setPreserveRatio(true);
    }
    imageView.setImage(image);
    StackPane imageBox = new StackPane();
    imageBox.getChildren().add(imageView);
    if(getCanvas() != QueleaApp.get().getProjectionWindow().getCanvas()
            && getCanvas() != QueleaApp.get().getStageWindow().getCanvas()) {
        imageBox.setStyle("-fx-background-color:#dddddd;");
    }
    imageBox.setVisible(false);
    getCanvas().getChildren().add(imageBox);
    getCanvas().pushLogoNoticeToFront();
    imageBox.setVisible(true);
    getCanvas().setOpacity(1);
}
 
Example 8
Source File: ImageDrawer.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw(Displayable displayable) {
    clear();
    if(getCanvas().getPlayVideo()) {
        VLCWindow.INSTANCE.stop();
    }
    imageView = getCanvas().getNewImageView();
    imageView.setFitWidth(getCanvas().getWidth());
    if(getCanvas().isStageView()) {
        image = Utils.getImageFromColour(QueleaProperties.get().getStageBackgroundColor());
    }
    else {
        image = ((ImageDisplayable) displayable).getImage();
        imageView.setPreserveRatio(true);
    }
    imageView.setImage(image);
    StackPane imageBox = new StackPane();
    imageBox.getChildren().add(imageView);
    if(getCanvas() != QueleaApp.get().getProjectionWindow().getCanvas()
            && getCanvas() != QueleaApp.get().getStageWindow().getCanvas()) {
        imageBox.setStyle("-fx-background-color:#dddddd;");
    }
    imageBox.setVisible(false);
    getCanvas().getChildren().add(imageBox);
    getCanvas().pushLogoNoticeToFront();
    imageBox.setVisible(true);
    getCanvas().setOpacity(1);
}
 
Example 9
Source File: InputField.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
public ErrorMsgPopup(@NotNull InputField inputField) {
	this.inputField = inputField;
	StackPane stackPane = new StackPane(lblMsg);
	stackPane.setPadding(new Insets(5));
	stackPane.setAlignment(Pos.BOTTOM_CENTER);
	stackPane.setStyle("-fx-background-color:red;");
	lblMsg.setTextFill(Color.WHITE);
	this.setAutoHide(true);

	getContent().add(stackPane);
}
 
Example 10
Source File: DatePickerDemo.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@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);
    final ObservableList<String> stylesheets = scene.getStylesheets();
    stylesheets.addAll(MainDemo.class.getResource("/css/jfoenix-fonts.css").toExternalForm(),
                       MainDemo.class.getResource("/css/jfoenix-design.css").toExternalForm());
    stage.setTitle("JFX Date Picker Demo");
    stage.setScene(scene);
    stage.show();

}
 
Example 11
Source File: WaitIndicator.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public WaitIndicator(Stage stage) {	
  	this.stage = stage;
  	//stage = new Stage();
  	indicator = new CircularProgressIndicator();
      StackPane pane = new StackPane(indicator);
      
//stackPane.setScaleX(1.2);
//stackPane.setScaleY(1.2);

      pane.setBackground(Background.EMPTY);
      pane.setStyle(
   		   //"-fx-border-style: none; "
   		   //"-fx-background-color: #231d12; "
      			"-fx-background-color: transparent; "
      			+ 
      			"-fx-background-radius: 1px;"
   		   );
      
      Scene scene = new Scene(pane, 128, 128, true);

scene.setFill(Color.TRANSPARENT);

stage.requestFocus();
      stage.initStyle(StageStyle.TRANSPARENT);
      stage.setTitle("Circular Progress Indicator");
      stage.setScene(scene);
      stage.toFront();
      stage.show();
      
      indicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
  }
 
Example 12
Source File: DiagramTab.java    From JetUML with GNU General Public License v3.0 4 votes vote down vote up
/**
    * Constructs a diagram tab initialized with pDiagram.
    * @param pDiagram The initial diagram
 */
public DiagramTab(Diagram pDiagram)
{
	aDiagram = pDiagram;
	DiagramTabToolBar sideBar = new DiagramTabToolBar(pDiagram);
	UserPreferences.instance().addBooleanPreferenceChangeHandler(sideBar);
	aDiagramCanvas = new DiagramCanvas(pDiagram);
	UserPreferences.instance().addBooleanPreferenceChangeHandler(aDiagramCanvas);
	aDiagramCanvasController = new DiagramCanvasController(aDiagramCanvas, sideBar, this);
	aDiagramCanvas.setController(aDiagramCanvasController);
	aDiagramCanvas.paintPanel();
	
	BorderPane layout = new BorderPane();
	layout.setRight(sideBar);

	// We put the diagram in a fixed-size StackPane for the sole purpose of being able to
	// decorate it with CSS. The StackPane needs to have a fixed size so the border fits the 
	// canvas and not the parent container.
	StackPane pane = new StackPane(aDiagramCanvas);
	final int buffer = 12; // (border insets + border width + 1)*2
	pane.setMaxSize(aDiagramCanvas.getWidth() + buffer, aDiagramCanvas.getHeight() + buffer);
	final String cssDefault = "-fx-border-color: grey; -fx-border-insets: 4;"
			+ "-fx-border-width: 1; -fx-border-style: solid;";
	pane.setStyle(cssDefault);
	
	// We wrap pane within an additional, resizable StackPane that can grow to fit the parent
	// ScrollPane and thus center the decorated canvas.
	ScrollPane scroll = new ScrollPane(new StackPane(pane));
	
	// The call below is necessary to removes the focus highlight around the Canvas
	// See issue #250
	scroll.setStyle("-fx-focus-color: transparent; -fx-faint-focus-color: transparent;"); 

	scroll.setFitToWidth(true);
	scroll.setFitToHeight(true);
	layout.setCenter(scroll);
	
	setTitle();
	setContent(layout);

	setOnCloseRequest(pEvent -> 
	{
		pEvent.consume();
		EditorFrame editorFrame = (EditorFrame) getTabPane().getParent();
		editorFrame.close(this);
	});
}
 
Example 13
Source File: RipplerDemo.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage stage) {

    //TODO drop shadow changes the width and height thus need to be considered
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);

    Label label = new Label("Click Me");
    label.setStyle(FX_BACKGROUND_COLOR_WHITE);
    label.setPadding(new Insets(20));
    JFXRippler rippler = new JFXRippler(label);
    rippler.setEnabled(false);
    main.getChildren().add(rippler);

    label.setOnMousePressed((e) -> {
        if (counter == 5) {
            step = -1;
        } else if (counter == 0) {
            step = 1;
        }
        JFXDepthManager.setDepth(label, counter += step % JFXDepthManager.getLevels());
    });

    Label l1 = new Label("TEST");
    l1.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l1.setPadding(new Insets(20));
    JFXRippler rippler1 = new JFXRippler(l1);
    main.getChildren().add(rippler1);
    JFXDepthManager.setDepth(rippler1, 1);

    Label l2 = new Label("TEST1");
    l2.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l2.setPadding(new Insets(20));
    JFXRippler rippler2 = new JFXRippler(l2);
    main.getChildren().add(rippler2);
    JFXDepthManager.setDepth(rippler2, 2);


    Label l3 = new Label("TEST2");
    l3.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l3.setPadding(new Insets(20));
    JFXRippler rippler3 = new JFXRippler(l3);
    main.getChildren().add(rippler3);
    JFXDepthManager.setDepth(rippler3, 3);

    Label l4 = new Label("TEST3");
    l4.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l4.setPadding(new Insets(20));
    JFXRippler rippler4 = new JFXRippler(l4);
    main.getChildren().add(rippler4);
    JFXDepthManager.setDepth(rippler4, 4);

    Label l5 = new Label("TEST4");
    l5.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l5.setPadding(new Insets(20));
    JFXRippler rippler5 = new JFXRippler(l5);
    main.getChildren().add(rippler5);
    JFXDepthManager.setDepth(rippler5, 5);

    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, 600, 400);

    stage.setTitle("JavaFX Ripple effect and shadows ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();

}
 
Example 14
Source File: Exercise_16_02.java    From Intro-to-Java-Programming with MIT License 4 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	// Set shape properties
	circle.setStroke(Color.BLACK);
	circle.setFill(Color.WHITE);
	rectangle.setStroke(Color.BLACK);
	rectangle.setWidth(150);
	rectangle.setFill(Color.WHITE);
	rectangle.setHeight(100);
	ellipse.setFill(Color.WHITE);
	ellipse.setStroke(Color.BLACK);
	ellipse.setRadiusX(100);
	ellipse.setRadiusY(50);

	// Create a hbox to hold buttons
	HBox paneForButtons = new HBox(5);
	paneForButtons.setAlignment(Pos.CENTER);
	RadioButton rbCircle = new RadioButton("Circle"); 
	RadioButton rbRectangle = new RadioButton("Rectangle"); 
	RadioButton rbEllipse = new RadioButton("Ellipse"); 

	// Create a toggle group for shapes
	ToggleGroup group = new ToggleGroup();
	rbCircle.setToggleGroup(group);
	rbRectangle.setToggleGroup(group);
	rbEllipse.setToggleGroup(group);

	// Create a check box
	CheckBox chkFill = new CheckBox("Fill");

	// Place buttons in the hbox
	paneForButtons.getChildren().addAll(rbCircle, 
		rbRectangle, rbEllipse, chkFill);

	// Create a stack pane to hold the shapes
	StackPane paneForShapes = new StackPane();
	paneForShapes.setStyle("-fx-border-color: black");

	// Create a border pane to hold nodes
	BorderPane pane = new BorderPane();
	pane.setBottom(paneForButtons);
	pane.setCenter(paneForShapes);

	// Create and register handlers
	rbCircle.setOnAction(e -> {
		if (rbCircle.isSelected()) {
			paneForShapes.getChildren().clear();
			paneForShapes.getChildren().add(circle);
		}
	});

	rbRectangle.setOnAction(e -> {
		if (rbRectangle.isSelected()) {
			paneForShapes.getChildren().clear();
			paneForShapes.getChildren().add(rectangle);
		}
	});

	rbEllipse.setOnAction(e -> {
		if (rbEllipse.isSelected()) {
			paneForShapes.getChildren().clear();
			paneForShapes.getChildren().add(ellipse);
		}
	});

	chkFill.setOnAction(e -> {
		if (chkFill.isSelected()) {
			circle.setFill(Color.BLACK);
			rectangle.setFill(Color.BLACK);
			ellipse.setFill(Color.BLACK);
		} else {
			circle.setFill(Color.WHITE);
			rectangle.setFill(Color.WHITE);
			ellipse.setFill(Color.WHITE);			}
	});

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane, 400, 150);
	primaryStage.setTitle("Exercise_16_02"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}
 
Example 15
Source File: HamburgerDemo.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
@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("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Burgers Demo :) ");
    stage.setScene(scene);
    stage.setResizable(false);

    stage.show();

}
 
Example 16
Source File: Flyout.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
     * Instructs this {@link Flyout} to begin its "reveal" 
     * animation.
     */
    @SuppressWarnings("restriction")
	public void flyout() {
        if(tl.getStatus() != Animation.Status.STOPPED) {
            return;
        }
        
        if(!shownOnce) {
            clipContainer = new StackPane();
            //clipContainer.setPadding(new Insets(0, 0, 0, 0));
            
            userNodeContainer.setStyle(userNodeContainerStyle);
            userNodeContainer.setManaged(false);
            userNodeContainer.setVisible(true);
            userNodeContainer.getChildren().add(flyoutContents);
            
            clipContainer.getChildren().add(userNodeContainer);
            clipContainer.setStyle("-fx-background-color: rgba(0, 0, 0, 0.5)");
            clipContainer.layoutBoundsProperty().addListener((v, o, n) -> {
                userNodeContainer.resize(n.getWidth(), n.getHeight());
            });
            
            Scene popupScene = new Scene(clipContainer, Color.TRANSPARENT);
            popup.initStyle(StageStyle.TRANSPARENT);
            popup.initOwner(anchor.getScene().getWindow());
            popup.setScene(popupScene);
/* 
            popup.initStyle(StageStyle.UTILITY);
            popup.setTitle("MarsNet");
            popup.setHeight(clipContainer.getHeight());
            popup.setWidth(clipContainer.getWidth());
*/
            //popup.setPadding(new Insets(0, 0, 0, 0));
            
            defineFlyout();

            popup.setOnShown(e -> {
                configureChildrenBounding();
            });
        }
        
        //setButtonStyle();
        
        popup.show();
        doFlyOut(false);
/*        
        // 2016-06-12 When popup loses the focus, it will close
        popup.focusedProperty().addListener(new ChangeListener<Boolean>()
	   	{
	   	  @Override
	   	  public void changed(javafx.beans.value.ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1)
	   	  {
	   		//mainScene.ToggleOffMarsNetButton();
	   		((ToggleButton)anchor).setSelected(false);
	   		dismiss();
	   	  }
	   	});
*/	   	
    }
 
Example 17
Source File: AnimationDemo.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage stage) {

    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);

    StackPane colorPane = new StackPane();
    colorPane.setStyle(STYLE);
    colorPane.getStyleClass().add("red-500");
    main.getChildren().add(colorPane);

    StackPane colorPane1 = new StackPane();
    colorPane1.setStyle(STYLE);
    colorPane1.getStyleClass().add("blue-500");

    StackPane placeHolder = new StackPane(colorPane1);
    placeHolder.setStyle(STYLE);
    main.getChildren().add(placeHolder);


    StackPane colorPane2 = new StackPane();
    colorPane2.setStyle(STYLE);
    colorPane2.getStyleClass().add("green-500");
    main.getChildren().add(colorPane2);

    StackPane colorPane3 = new StackPane();
    colorPane3.setStyle(STYLE);
    colorPane3.getStyleClass().add("yellow-500");
    main.getChildren().add(colorPane3);


    StackPane colorPane4 = new StackPane();
    colorPane4.setStyle(STYLE);
    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 FlowPaneStackPaneJFXNodesAnimation(main,
                                                                                              nextPage,
                                                                                              wizard,
                                                                                              colorPane1);

    colorPane1.setOnMouseClicked((click) -> animation.animate());

    final Scene scene = new Scene(wizard, 800, 200);
    final ObservableList<String> stylesheets = scene.getStylesheets();
    stylesheets.addAll(ButtonDemo.class.getResource("/css/jfoenix-design.css").toExternalForm(),
                       ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Button Demo");
    stage.setScene(scene);
    stage.show();

}
 
Example 18
Source File: SecondStage.java    From JavaFX with MIT License 4 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	// setup some dynamic data to display.
	final String STANDARD_TEXT = "Every Good Boy Deserves Fruit";
	final String ALTERNATE_TEXT = "Good Boys Deserve Fruit Always";
	final Label label = new Label(STANDARD_TEXT);

	// configure the primary stage.
	StackPane primaryLayout = new StackPane();
	primaryLayout.getChildren().add(label);
	primaryLayout
			.setStyle("-fx-background-color: lightgreen; -fx-padding: 10;");
	primaryStage.setScene(new Scene(primaryLayout, 200, 100));
	primaryStage.setTitle("Primary Stage");

	// configure the secondary stage.
	final Stage secondaryStage = new Stage(StageStyle.DECORATED);
	CheckBox alternateTextCheck = new CheckBox("Show alternate text");
	alternateTextCheck.selectedProperty().addListener(
			new ChangeListener<Boolean>() {
				@Override
				public void changed(
						ObservableValue<? extends Boolean> selected,
						Boolean oldValue, Boolean newValue) {
					if (newValue)
						label.setText(ALTERNATE_TEXT);
					else
						label.setText(STANDARD_TEXT);
				}
			});
	StackPane secondaryLayout = new StackPane();
	secondaryLayout.getChildren().add(alternateTextCheck);
	secondaryLayout
			.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
	secondaryStage.setScene(new Scene(secondaryLayout, 200, 100));
	secondaryStage.setTitle("Secondary Stage");

	// specify stage locations.
	secondaryStage.setX(400);
	secondaryStage.setY(200);
	primaryStage.setX(400);
	primaryStage.setY(350);

	// add a trigger to hide the secondary stage when the primary stage is
	// hidden.
	// this will cause all stages to be hidden (which will cause the app to
	// terminate).
	primaryStage.setOnHidden(new EventHandler<WindowEvent>() {
		@Override
		public void handle(WindowEvent onClosing) {
			secondaryStage.hide();
		}
	});

	// show both stages.
	primaryStage.show();
	secondaryStage.show();
}
 
Example 19
Source File: TranslatePanel.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Create the translation dialog.
 */
public TranslatePanel() {
    splitPane = new SplitPane();
    defaultLyricsArea = new LyricsTextArea();
    StackPane translationPane = new StackPane();
    tabPane = new TabPane();
    translationPane.getChildren().add(tabPane);
    addTranslationButton = new Button("", new ImageView(new Image("file:icons/newstar.png", 16, 16, false, true)));
    Utils.setToolbarButtonStyle(addTranslationButton);
    addTranslationButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            final String name = NewTranslationDialog.getTranslationName(getExistingNames());
            if (name != null) {
                final TranslateTab tab = new TranslateTab(name, "");
                tabPane.getTabs().add(tab);
                copyStage.showAndAssociate(TranslatePanel.this);
                translateThread = new Thread() {
                    @Override
                    public void run() {
                        interrupted = false;
                        String lyrics = null;
                        try {
                            lyrics = getTranslatedLyrics(name);
                        } catch (Exception ex) {
                            LOGGER.log(Level.INFO, "Interrupted translating", ex);
                            interrupted = true;
                        }

                        if (!interrupted) {
                            final String fiLyrics = lyrics;
                            Platform.runLater(new Runnable() {
                                @Override
                                public void run() {
                                    copyStage.hide();
                                    if (fiLyrics != null && !fiLyrics.isEmpty()) {
                                        tab.setLyrics(fiLyrics);
                                    }
                                }
                            });
                        }
                    }
                };
                translateThread.start();
            }
        }
    });
    addTranslationButton.setTooltip(new Tooltip(LabelGrabber.INSTANCE.getLabel("add.translation.button")));
    StackPane.setAlignment(addTranslationButton, Pos.TOP_RIGHT);
    translationPane.getChildren().add(addTranslationButton);
    StackPane.setMargin(addTranslationButton, new Insets(5));
    BorderPane leftArea = new BorderPane();
    StackPane topRegion = new StackPane();
    Text defaultTranslationLabel = new Text(LabelGrabber.INSTANCE.getLabel("default.translation.label"));
    defaultTranslationLabel.setFill(Color.WHITE);
    StackPane.setAlignment(defaultTranslationLabel, Pos.CENTER_LEFT);
    StackPane.setMargin(defaultTranslationLabel, new Insets(5));
    topRegion.getChildren().add(defaultTranslationLabel);
    topRegion.setPrefHeight(31);
    topRegion.setStyle("-fx-background-color:rgb(166,166,166);"); //Match the tabpane header background.
    topRegion.setMaxWidth(Double.MAX_VALUE);
    leftArea.setTop(topRegion);
    leftArea.setCenter(defaultLyricsArea);
    splitPane.getItems().add(leftArea);
    splitPane.getItems().add(translationPane);

    setCenter(splitPane);
}
 
Example 20
Source File: ScenicViewGui.java    From scenic-view with GNU General Public License v3.0 4 votes vote down vote up
private void buildUI() {
    rootBorderPane = new BorderPane();
    rootBorderPane.setId(StageController.FX_CONNECTOR_BASE_ID + "scenic-view");
    
    // search bar
    buildFiltersBox();

    // menubar
    buildMenuBar();

    // main splitpane
    splitPane = new SplitPane();
    splitPane.setId("main-splitpane");

    
    // treeview
    treeView = new ScenegraphTreeView(activeNodeFilters, this);
    treeViewScanningPlaceholder = new VBox(10) {
        {
            ProgressIndicator progress = new ProgressIndicator();
            Label label = new Label("Scanning for JavaFX applications");
            label.getStyleClass().add("scanning-label");
            getChildren().addAll(progress, label);
            
            setAlignment(Pos.CENTER);
            
            treeView.expandedItemCountProperty().addListener(o -> {
                setVisible(treeView.getExpandedItemCount() == 0);
            });
            
        }
    };
    
    StackPane treeViewStackPane = new StackPane(treeView, treeViewScanningPlaceholder);
    treeViewStackPane.setStyle(" -fx-padding: 0");

    treeView.setMaxHeight(Double.MAX_VALUE);
    
    // right side
    detailsTab = new DetailsTab(this, new Consumer<String>() {
        @Override public void accept(String property) {
            ScenicViewGui.this.loadAPI(property);
        }
    });

    animationsTab = new AnimationsTab(this);

    tabPane = new TabPane();
    tabPane.getSelectionModel().selectedItemProperty().addListener((ov, oldValue, newValue) -> updateMenuBar(oldValue, newValue));

    javadocTab = new JavaDocTab(this); 
    
    eventsTab = new EventLogTab(this);
    eventsTab.activeProperty().addListener((ov, oldValue, newValue) -> {
        configuration.setEventLogEnabled(newValue);
        configurationUpdated();
    });
    
    // 3Dom
    threeDOMTab = new ThreeDOMTab(this); 
    
    // CSSFX
    cssfxTab = new CSSFXTab(this);
    
    tabPane.getTabs().addAll(detailsTab, eventsTab, /*animationsTab,*/ javadocTab, threeDOMTab, cssfxTab);
    // /3Dom
    
    Persistence.loadProperty("splitPaneDividerPosition", splitPane, 0.3);

    // putting it all together
    splitPane.getItems().addAll(treeViewStackPane, tabPane);

    rootBorderPane.setCenter(splitPane);
    
    // status bar
    statusBar = new StatusBar();
    
    bottomVBox = new VBox(searchBar, statusBar);

    rootBorderPane.setBottom(bottomVBox);

    Persistence.loadProperty("stageWidth", scenicViewStage, 800);
    Persistence.loadProperty("stageHeight", scenicViewStage, 800);
}