set JavaFX Pane Clip - Java JavaFX

Java examples for JavaFX:Layout

Description

set JavaFX Pane Clip

Demo Code


//package com.java2s;

import javafx.beans.binding.ObjectBinding;

import javafx.scene.Node;

import javafx.scene.layout.Pane;
import javafx.scene.shape.Rectangle;

public class Main {
    public static void setPaneClip(final Pane container) {
        container.clipProperty().bind(new ObjectBinding<Node>() {
            {/*ww  w. ja va  2  s  .  c o m*/
                bind(container.widthProperty(), container.heightProperty());
            }

            @Override
            protected Node computeValue() {
                return new Rectangle(container.getWidth(), container
                        .getHeight());
            }
        });
    }
}

Related Tutorials