Example usage for java.awt Rectangle createUnion

List of usage examples for java.awt Rectangle createUnion

Introduction

In this page you can find the example usage for java.awt Rectangle createUnion.

Prototype

public Rectangle2D createUnion(Rectangle2D r) 

Source Link

Usage

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(10, 10, 50, 40);

    System.out.println(r.createUnion(new Rectangle(20, 20, 40, 40)));

    g2.fill(r);/* w  ww. java2  s.  c  om*/
}