Package javafx.scene.layout

Examples of javafx.scene.layout.StackPane


        URL location = getClass().getResource("main.fxml");
        FXMLLoader loader = new FXMLLoader(location);
        mainUI = loader.load();
        controller = loader.getController();
        // Configure the window with a StackPane so we can overlay things on top of the main UI.
        uiStack = new StackPane(mainUI);
        mainWindow.setTitle(APP_NAME);
        final Scene scene = new Scene(uiStack);
        TextFieldValidator.configureScene(scene);   // Add CSS that we need.
        mainWindow.setScene(scene);
View Full Code Here


    shadow.offsetXProperty().bind(transition.fractionProperty().multiply(32));
    shadow.offsetYProperty().bind(transition.fractionProperty().multiply(32));
    button.translateXProperty().bind(transition.fractionProperty().multiply(-32));
    transition.play();
   
    StackPane pane = new StackPane();
    pane.getChildren().add(button);
   
    Scene myScene = new Scene(pane, 800, 600);
    primaryStage.setScene(myScene);
    primaryStage.show();
  }
View Full Code Here

        //
        // The Buttons are StackPanes with a Path on top
        //
        // Button Up
        btnUp = new StackPane();
        btnUp.getStyleClass().add("arrow-button");
        arrowUp = new Path();
        arrowUp.getStyleClass().add("spinner-arrow");
        arrowUp.getElements().addAll(new MoveTo(-ARROW_SIZE, 0), new LineTo(0, -ARROW_SIZE * ARROW_HEIGHT),
                new LineTo(ARROW_SIZE, 0));
        btnUp.getChildren().add(arrowUp);

        // Button Down
        btnDown = new StackPane();
        btnDown.getStyleClass().add("arrow-button");
        arrowDown = new Path();
        arrowDown.getStyleClass().add("spinner-arrow");
        arrowDown.getElements().addAll(new MoveTo(-ARROW_SIZE, 0), new LineTo(0, ARROW_SIZE * ARROW_HEIGHT),
                new LineTo(ARROW_SIZE, 0));
View Full Code Here

       
        final SVGPath rightSide = new SVGPath();
        rightSide.setContent("M0,0 L5,0 15,15 5,30 0,30 Z");
        rightSide.getStyleClass().add("breadcrumbitem-ui");
        rightSide.setLayoutY(10);
        final StackPane stackPane = new StackPane();
        stackPane.getStyleClass().add("breadcrumbitem-ui");
        stackPane.setAlignment(Pos.CENTER);
       
        final HBox stackContent = new HBox(10);
        stackContent.setAlignment(Pos.CENTER);
       
        stackPane.getChildren().add(stackContent);
       
        box.getChildren().add(leftSide);
        box.getChildren().add(stackPane);

        final Label textLabel = new Label();
        if (c != null) {
            if (c.getIcon() != null) {
                ImageView iv = new ImageView(c.getIcon());
                iv.setPreserveRatio(true);
                iv.setFitHeight(20);
                stackContent.getChildren().add(iv);
            }
           
            if(c.getSvgIcon() != null) {
                stackContent.getChildren().add(c.getSvgIcon());
            }
           
            if (c.getText() != null) {
                textLabel.setText(c.getText());
                textLabel.getStyleClass().add("breadcrumbitem-text");
                stackContent.getChildren().add(textLabel);
            }
        }
        box.getChildren().add(rightSide);
       
        leftSide.addEventHandler(MouseEvent.ANY, new BreadcrumbItemMouseHandler(){
            {
                getNodes().add(rightSide);
                getNodes().add(stackPane);
                if(!textLabel.getText().isEmpty()) {
                    getNodes().add(textLabel);
                }
            }
        });
       
        rightSide.addEventHandler(MouseEvent.ANY, new BreadcrumbItemMouseHandler(){
            {
                getNodes().add(leftSide);
                getNodes().add(stackPane);
                if(!textLabel.getText().isEmpty()) {
                    getNodes().add(textLabel);
                }
            }
        });
       
        stackPane.addEventHandler(MouseEvent.ANY, new BreadcrumbItemMouseHandler(){
            {
                getNodes().add(rightSide);
                getNodes().add(leftSide);
                if(!textLabel.getText().isEmpty()) {
                    getNodes().add(textLabel);
View Full Code Here

    scale.yProperty().bind(localScaleFactor);
    param = new SnapshotParameters();
    param.setDepthBuffer(true);
    param.setTransform(scale);

    final StackPane mainContent = new StackPane();
    final Circle frame = new Circle();
    frame.getStyleClass().add("magnifier-frame");
    frame.radiusProperty().bind(localRadius.add(frameWidthProperty));
   
    final Circle cClip = new Circle();
    cClip.radiusProperty().bind(localRadius);
    cClip.translateXProperty().bind(localRadius);
    cClip.translateYProperty().bind(localRadius);

    viewer = new Viewer(localRadius, localRadius);
    viewer.setClip(cClip);

    final Line vL = new Line();
    vL.setStartX(0);
    vL.setStartY(0);
    vL.setEndX(0);
    vL.getStyleClass().add("magnifier-vLine");
    vL.strokeWidthProperty().bind(scopeLineWidthProperty);
    vL.visibleProperty().bind(scopeLinesVisibleProperty);
    vL.endYProperty().bind(localRadius.multiply(2));

    final Line hL = new Line();
    hL.setStartX(0);
    hL.setStartY(0);
    hL.setEndY(0);
    hL.getStyleClass().add("magnifier-hLine");
    hL.strokeWidthProperty().bind(scopeLineWidthProperty);
    hL.visibleProperty().bind(scopeLinesVisibleProperty);
    hL.endXProperty().bind(localRadius.multiply(2));

    // Adding all parts in a container.
    mainContent.getChildren().addAll(frame, viewer, vL, hL);

    final Popup popUp = new Popup();
    popUp.getContent().add(mainContent);

    final EventHandler<MouseEvent> enteredEvent = new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent e) {
        popUp.show(getSkinnable(), e.getScreenX() - shift, e.getScreenY() - shift);
        takeSnap(e.getX(), e.getY());
      }
    };
    final EventHandler<MouseEvent> exitedEvent = new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent e) {
        popUp.hide();
      }
    };
    final EventHandler<MouseEvent> movedEvent = new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent e) {
        final double r = localRadius.get();
        final double s = localScaleFactor.get();
        if (e.getSceneX() > (scene.getWidth() - (2 * r))) {
          popUp.setX(e.getScreenX() - (2 * r) - shift);
        } else {
          popUp.setX(e.getScreenX() - shift);
        }

        if (e.getSceneY() > (scene.getHeight() - (2 * r))) {
          popUp.setY(e.getScreenY() - (2 * r) - shift);
        } else {
          popUp.setY(e.getScreenY() - shift);
        }
        prevX.set(e.getX());
        prevY.set(e.getY());
        shiftViewerContent(prevX.get(), prevY.get(), r, s);
      }
    };

    // Adding mask implementation. The below mask is responsible to not access the contents when magnifier is shown.
    final StackPane mask = new StackPane();

    // Adding listener to activateProperty.
    getSkinnable().activeProperty().addListener(new InvalidationListener() {
      @Override
      public void invalidated(Observable arg0) {
View Full Code Here

* Created by Thomas Bolz on 01.01.14.
*/
public class BigDecimalFieldTest extends GuiTest {

    public Parent getRootNode() {
        StackPane root = new StackPane();

        nf = NumberFormat.getNumberInstance(Locale.UK);
        nf.setMaximumFractionDigits(2);
        nf.setMinimumFractionDigits(2);
        bigDecimalField1 = new BigDecimalField(new BigDecimal(10), new BigDecimal(2), nf);
        bigDecimalField2 = new BigDecimalField(new BigDecimal(20), new BigDecimal(2), nf);
        root.getChildren().addAll(new VBox(bigDecimalField1, bigDecimalField2));

        return root;
    }
View Full Code Here

        init();
    }

    private void init() {
        getStyleClass().setAll(DEFAULT_STYLE_CLASS);
        setContentPane(new StackPane());

        // TODO ugly to do this in control? probably violates pattern rules?
        boundsListener = new ChangeListener<Bounds>() {
            @Override
            public void changed(ObservableValue<? extends Bounds> ov, Bounds t, Bounds t1) {
View Full Code Here

  private final Label tooltipText = new Label();
  private Popup tooltipPopup;

  private void layoutDemo() {
    tooltipText.setWrapText(true);
    StackPane separator = new StackPane();
    separator.setMaxWidth(1);
    separator.setPrefWidth(2.5);
    separator.getStyleClass().add("divider");
    HBox.setMargin(separator, new Insets(20, 10, 20, 0));

    HBox pane = new HBox();
    pane.setSpacing(10);
    pane.setAlignment(Pos.TOP_RIGHT);
View Full Code Here

  private List<StackPane> buttonsList = new ArrayList<>();
  private int currentBtn = -1;

  protected Node getButton(String text, final int id) {
    final StackPane sp = new StackPane();
    sp.getStyleClass().add("sample-button");
    sp.getChildren().add(new Label(text));
    buttonsList.add(sp);
    sp.setOnMouseClicked(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent arg0) {
        if (id != currentBtn) {
          showSample(sp, id);
        }
View Full Code Here

    gp.addRow(8, getSep("Resizable On Scroll", MagnifierDoc.resizableOnScroll), new Label(":"), resizeOnScrollCB, getSpacer());
    return gp;
  }

  private Node getSpacer() {
    StackPane spacer = new StackPane();
    spacer.setMinWidth(50);
    spacer.getChildren().add(new Label(""));
    return spacer;
  }
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.