build JavaFX Rectangle - Java javafx.scene.shape

Java examples for javafx.scene.shape:Rectangle

Description

build JavaFX Rectangle

Demo Code


//package com.java2s;

import javafx.scene.shape.Rectangle;

public class Main {

    public static Rectangle buildRectangle(double sx, double sy, double w,
            double h) {
        Rectangle r = new Rectangle();
        r.setX(sx);//from   w ww .jav  a 2  s . c o m
        r.setY(sy);
        r.setWidth(w);
        r.setHeight(h);
        return r;
    }

    /**
     *
     * @param sx
     * @param sy
     * @param w
     * @param h
     * @param aw
     * @param ah
     * @return
     */
    public static Rectangle buildRectangle(double sx, double sy, double w,
            double h, double aw, double ah) {
        Rectangle r = buildRectangle(sx, sy, w, h);
        r.setArcWidth(aw);
        r.setArcHeight(ah);
        return r;
    }
}

Related Tutorials