Package javafx.scene.layout

Examples of javafx.scene.layout.StackPane


    label.setGraphicTextGap(10);
    return label;
  }

  private StackPane getHelpIcon(final String str) {
    final StackPane help = new StackPane();
    help.setMinHeight(12);
    help.setMinWidth(10);
    help.setMaxHeight(12);
    help.setMaxWidth(10);
    help.setPrefHeight(12);
    help.setPrefWidth(10);
    help.getStyleClass().add("helpIcon");
    help.getChildren().add(new Label("?"));
    help.setOnMouseEntered(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent e) {
        tooltipText.setText(str);
        showToolTip(help);
      }
    });
    help.setOnMouseExited(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent arg0) {
        getPopup().hide();
      }
    });
View Full Code Here


    return help;
  }

  private Popup getPopup() {
    if (tooltipPopup == null) {
      final StackPane cont = new StackPane();
      cont.setMaxWidth(275);
      cont.getStyleClass().add("doc-tool-tip");
      cont.getChildren().add(tooltipText);

      final Popup popup = new Popup();
      popup.setAutoHide(true);
      popup.setAutoFix(true);
      popup.setHideOnEscape(true);
View Full Code Here

  private void configure() {

    final Label titleLabel = new Label(title);
    titleLabel.getStyleClass().add("titleLabel");

    final StackPane sep = new StackPane();
    sep.setMinWidth(1);
    sep.setMaxWidth(1);
    sep.setMaxHeight(40);
    sep.getStyleClass().add("headerSeparator");

    final Label subTitleLabel = new Label("A JFXtras-Labs Demo");
    subTitleLabel.getStyleClass().add("subTitleLabel");

    final HBox row = new HBox();
    row.setSpacing(15);
    row.setPadding(new Insets(0, 0, 0, 30));
    row.setAlignment(Pos.CENTER_LEFT);
    row.setPrefHeight(100);
    row.getChildren().addAll(titleLabel, sep, subTitleLabel);

    final StackPane header = new StackPane();
    header.setMaxHeight(100);
    header.setPrefHeight(100);
    header.getStyleClass().add("headerBg");
    header.getChildren().add(row);

    body = new StackPane();
    body.getStyleClass().add("bodyBg");
    body.setPadding(new Insets(15));

    StackPane footer = new StackPane();
    footer.setMaxHeight(5);
    footer.setPrefHeight(5);
    footer.getStyleClass().add("footerBg");

    stage.setTitle(title);
    stage.setWidth(1200);
    stage.setHeight(700);
View Full Code Here

            @Override public void changed(ObservableValue<? extends MacOSDefaultIcons> observable, MacOSDefaultIcons oldValue,
                    MacOSDefaultIcons newValue) {
                if (newValue != null && newValue != oldValue) {
                    if (newValue == MacOSDefaultIcons.SHARE) {
                        StackPane stack = new StackPane();
                        String iconBase = MacOSDefaultIcons.SHARE.getStyleName();
                        stack.getStyleClass().add("aquaicon");
                        Region svgIcon = new Region();
                        svgIcon.getStyleClass().add(iconBase + "-square");
                        stack.getChildren().add(svgIcon);
                        Region svgIcon2 = new Region();
                        svgIcon2.getStyleClass().add(iconBase + "-arrow");
                        stack.getChildren().add(svgIcon2);
                        getSkinnable().setGraphic(stack);
                    } else {
                        Region svgIcon = new Region();
                        svgIcon.getStyleClass().add("aqua-" + newValue.getStyleName());
                        svgIcon.getStyleClass().add("aquaicon");
View Full Code Here

                determinateProgressTransition.setAutoReverse(false);
                determinateProgressTransition.setInterpolator(Interpolator.LINEAR);
                determinateProgressTransition.fractionProperty().addListener(new ChangeListener<Number>() {

                    @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
                        StackPane bar = ((StackPane) getSkinnable().lookup(".bar"));
                        int start = 1 - (int) ((38 * bar.getHeight() / 20) * newValue.doubleValue());
                        ImagePattern pattern = new ImagePattern(image, start, 0, (38 * bar.getHeight() / 20), bar.getHeight(), false);

                        BackgroundFill backkgroudFill = new BackgroundFill(pattern, new CornerRadii(0), new Insets(0));

                        bar.setBackground(new Background(backkgroudFill));
                    }
                });
                determinateProgressTransition.play();
            }
        } else {
            StackPane bar = ((StackPane) getSkinnable().lookup(".bar"));
            ImagePattern pattern = new ImagePattern(image, 0, 0, (38 * bar.getHeight() / 20), bar.getHeight(), false);
            BackgroundFill backkgroudFill = new BackgroundFill(pattern, new CornerRadii(0), new Insets(0));
            bar.setBackground(new Background(backkgroudFill));
        }
    }
View Full Code Here

            setManaged(false);
            final TabPane tabPane = getSkinnable();

            headerClip = new Rectangle();
           
            headersRegion = new StackPane() {
                @Override protected double computePrefWidth(double height) {
                    double width = 0.0F;
                    for (Node child : getChildren()) {
                        TabHeaderSkin tabHeaderSkin = (TabHeaderSkin)child;
                        if (tabHeaderSkin.isVisible()) {
                            width += tabHeaderSkin.prefWidth(height);
                        }
                    }
                    return snapSize(width) + snappedLeftInset() + snappedRightInset();
                }

                @Override protected double computePrefHeight(double width) {
                    double height = 0.0F;
                    for (Node child : getChildren()) {
                        TabHeaderSkin tabHeaderSkin = (TabHeaderSkin)child;
                        height = Math.max(height, tabHeaderSkin.prefHeight(width));
                    }
                    return snapSize(height) + snappedTopInset() + snappedBottomInset();
                }

                @Override protected void layoutChildren() {
                    if (tabsFit()) {
                        setScrollOffset(0.0);
                    } else {
                        if (!removeTab.isEmpty()) {                           
                            double offset = 0;
                            double w = tabHeaderArea.getWidth() - snapSize(controlButtons.prefWidth(-1)) - firstTabIndent() - SPACER;
                            Iterator i = getChildren().iterator();
                            while (i.hasNext()) {
                                TabHeaderSkin tabHeader = (TabHeaderSkin)i.next();
                                double tabHeaderPrefWidth = snapSize(tabHeader.prefWidth(-1));
                                if (removeTab.contains(tabHeader)) {                                   
                                    if (offset < w) {
                                        isSelectingTab = true;
                                    }
                                    i.remove();
                                    removeTab.remove(tabHeader);
                                    if (removeTab.isEmpty()) {
                                        break;
                                    }
                                }
                                offset += tabHeaderPrefWidth;                               
                            }
                        } else {
                            isSelectingTab = true;
                        }
                    }

                    if (isSelectingTab) {
                        double offset = 0;
                        double selectedTabOffset = 0;
                        double selectedTabWidth = 0;
                        double previousSelectedTabOffset = 0;
                        double previousSelectedTabWidth = 0;
                        for (Node node: getChildren()) {
                            TabHeaderSkin tabHeader = (TabHeaderSkin)node;
                            // size and position the header relative to the other headers
                            double tabHeaderPrefWidth = snapSize(tabHeader.prefWidth(-1));
                            if (selectedTab != null && selectedTab.equals(tabHeader.getTab())) {
                                selectedTabOffset = offset;
                                selectedTabWidth = tabHeaderPrefWidth;
                            }
                            if (previousSelectedTab != null && previousSelectedTab.equals(tabHeader.getTab())) {
                                previousSelectedTabOffset = offset;
                                previousSelectedTabWidth = tabHeaderPrefWidth;
                            }
                            offset+=tabHeaderPrefWidth;
                        }
                        if (selectedTabOffset > previousSelectedTabOffset) {
                            scrollToSelectedTab(selectedTabOffset + selectedTabWidth, previousSelectedTabOffset);
                        } else {
                            scrollToSelectedTab(selectedTabOffset, previousSelectedTabOffset);
                        }
                        isSelectingTab = false;
                    }

                    Side tabPosition = getSkinnable().getSide();
                    double tabBackgroundHeight = snapSize(prefHeight(-1));
                    double tabX = (tabPosition.equals(Side.LEFT) || tabPosition.equals(Side.BOTTOM)) ?
                        snapSize(getWidth()) - getScrollOffset() : getScrollOffset();

                    updateHeaderClip();
                    for (Node node : getChildren()) {
                        TabHeaderSkin tabHeader = (TabHeaderSkin)node;
                        // size and position the header relative to the other headers
                        double tabHeaderPrefWidth = snapSize(tabHeader.prefWidth(-1));
                        double tabHeaderPrefHeight = snapSize(tabHeader.prefHeight(-1));
                        tabHeader.resize(tabHeaderPrefWidth, tabHeaderPrefHeight);
                        // This ensures that the tabs are located in the correct position
                        // when there are tabs of differing heights.
                        double startY = tabPosition.equals(Side.BOTTOM) ?
                            0 : tabBackgroundHeight - tabHeaderPrefHeight - snappedBottomInset();
                        if (tabPosition.equals(Side.LEFT) || tabPosition.equals(Side.BOTTOM)) {
                            // build from the right
                            tabX -= tabHeaderPrefWidth;
                            tabHeader.relocate(tabX, startY);
                        } else {
                            // build from the left
                            tabHeader.relocate(tabX, startY);
                            tabX += tabHeaderPrefWidth;
                        }
                    }
                }
            };
            headersRegion.getStyleClass().setAll("headers-region");
            headersRegion.setClip(headerClip);

            headerBackground = new StackPane();
            headerBackground.getStyleClass().setAll("tab-header-background");

            int i = 0;
            for (Tab tab: tabPane.getTabs()) {
                addTab(tab, i++, true);
View Full Code Here

            setClip(clip);

            label = new Label(tab.getText(), tab.getGraphic());
            label.getStyleClass().setAll("tab-label");

            closeBtn = new StackPane() {
                @Override protected double computePrefWidth(double h) {
                    return CLOSE_BTN_SIZE;
                }
                @Override protected double computePrefHeight(double w) {
                    return CLOSE_BTN_SIZE;
                }
            };
            closeBtn.getStyleClass().setAll("tab-close-button");
            closeBtn.setOnMousePressed(new EventHandler<MouseEvent>() {
                @Override public void handle(MouseEvent me) {
                    Tab tab = getTab();
                    TabPaneBehavior behavior = getBehavior();
                    if (behavior.canCloseTab(tab)) {
                         removeListeners(tab);
                         behavior.closeTab(tab);
                         setOnMousePressed(null);   
                    }
                }
            });
           
            updateGraphicRotation();

            final int padding = 2;
            final Region focusIndicator = new Region();
            focusIndicator.setMouseTransparent(true);
            focusIndicator.getStyleClass().add("focus-indicator");
           
            inner = new StackPane() {
                @Override protected void layoutChildren() {
                    final TabPane skinnable = getSkinnable();
                   
                    final double paddingTop = snappedTopInset();
                    final double paddingRight = snappedRightInset();
View Full Code Here

            TabPane tabPane = getSkinnable();

            downArrowBtn = new Pane();
            downArrowBtn.getStyleClass().setAll("tab-down-button");
            downArrowBtn.setVisible(isShowTabsMenu());
            downArrow = new StackPane();
            downArrow.setManaged(false);
            downArrow.getStyleClass().setAll("arrow");
            downArrow.setRotate(tabPane.getSide().equals(Side.BOTTOM) ? 180.0F : 0.0F);
            downArrowBtn.getChildren().add(downArrow);
            downArrowBtn.setOnMouseClicked(new EventHandler<MouseEvent>() {
                @Override public void handle(MouseEvent me) {
                    showPopupMenu();
                }
            });
           
            setupPopupMenu();

            inner = new StackPane() {
                private double getArrowBtnWidth() {
                    if (animationLock) return maxArrowWidth;
                    if (isShowTabsMenu()) {
                        maxArrowWidth = Math.max(maxArrowWidth, snapSize(downArrow.prefWidth(getHeight())) + snapSize(downArrowBtn.prefWidth(getHeight())));
                    }
View Full Code Here

          //hbox.setAlignment(Pos.CENTER);
      mediaPlayer.setAutoPlay(true);
      mediaPlayer.setCycleCount(MediaPlayer.INDEFINITE);   
      MediaView mediaView = new MediaView(mediaPlayer);
      StackPane.setAlignment(iv1, Pos.CENTER_LEFT);
      StackPane stack=new StackPane();
        StackPane stack2=new StackPane();
        //stack2.getChildren().addAll(iv1,vbox);
      stack2.getChildren().addAll(iv1,hbox);
      stack.getChildren().addAll(mediaView,stack2);
      ((Group)scene.getRoot()).getChildren().addAll(stack, stack2);
          return scene;    
      }
View Full Code Here

        popup.getContent().setAll(createPopupContent(INFO_TEXT));

        return popup;
    }
    private Node createPopupContent(final String INFO_TEXT) {
        StackPane popupPane = new StackPane();
        popupPane.getStylesheets().add(getClass().getResource("validationpane.css").toExternalForm());
        popupPane.getStyleClass().add("popup");

        Label label = new Label(INFO_TEXT);
        label.getStyleClass().add("info-text");

        popupPane.getChildren().setAll(label);

        return popupPane;
    }
View Full Code Here

TOP

Related Classes of javafx.scene.layout.StackPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.