コード例 #1
0
ファイル: JFXButtonSkin.java プロジェクト: kesh1018/JFoenix
 private void updateButtonType(ButtonType type) {
   switch (type) {
     case RAISED:
       JFXDepthManager.setDepth(buttonContainer, 2);
       clickedAnimation = new ButtonClickTransition();
       break;
     default:
       buttonContainer.setEffect(null);
       break;
   }
 }
コード例 #2
0
  public void setSimpleOverlay(Parent content) {
    BorderPane con = new BorderPane();
    BorderPane background = new BorderPane(content);
    BorderPane.setMargin(background, new Insets(50));

    background.setStyle("-fx-background-color: rgba(41, 41, 41, 0);");
    contentPane.setEffect(new BoxBlur());

    con.setCenter(background);
    con.setPickOnBounds(true);
    overlayPane.setCenter(con);
  }
コード例 #3
0
  @Override
  public void start(Stage stage) {

    DropShadow dropShadow = new DropShadow(10.0, Color.rgb(150, 50, 50, .688));
    dropShadow.setOffsetX(4);
    dropShadow.setOffsetY(6);

    StackPane stackPane = new StackPane();
    stackPane.setAlignment(Pos.CENTER);
    stackPane.setEffect(dropShadow);

    Rectangle rectangle = new Rectangle(100, 50, Color.LEMONCHIFFON);
    rectangle.setArcWidth(30);
    rectangle.setArcHeight(30);

    Text text = new Text();
    text.setFont(Font.font("Tahoma", FontWeight.BOLD, 18));

    stackPane.getChildren().addAll(rectangle, text);

    final Scene scene = new Scene(stackPane, 400, 200, Color.LIGHTSKYBLUE);
    stage.setTitle("Custom Binding");

    rectangle.widthProperty().bind(scene.widthProperty().divide(2));
    rectangle.heightProperty().bind(scene.heightProperty().divide(2));

    DoubleBinding opacityBinding =
        new DoubleBinding() {
          {
            // List the dependencies with super.bind()
            super.bind(scene.widthProperty(), scene.heightProperty());
          }

          @Override
          protected double computeValue() {
            // Return the computed value
            double opacity = (scene.getWidth() + scene.getHeight()) / 1000;
            return (opacity > 1.0) ? 1.0 : opacity;
          }
        };
    rectangle.opacityProperty().bind(opacityBinding);
    text.textProperty().bind((Bindings.format("opacity = %.2f", opacityBinding)));

    ObjectBinding<Color> colorBinding =
        new ObjectBinding<Color>() {
          {
            super.bind(scene.fillProperty());
          }

          @Override
          protected Color computeValue() {
            if (scene.getFill() instanceof Color) {
              return ((Color) scene.getFill()).darker();
            } else {
              return Color.GRAY;
            }
          }
        };

    text.fillProperty().bind(colorBinding);

    stage.setScene(scene);
    stage.show();
  }
コード例 #4
0
 public void hideOverlay() {
   overlayPane.setCenter(null);
   contentPane.setEffect(null);
 }