MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / Rectangle2D

Class Rectangle2D

CodenameOne/src/com/codename1/ui/geom/Rectangle2D.java:32–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30///
31/// @author Chen Fishbein
32public class Rectangle2D implements Shape {
33
34 private final Dimension2D size;
35 private double x;
36 private double y;
37 private GeneralPath path;
38
39 /// Creates a new instance of Rectangle
40 public Rectangle2D() {
41 size = new Dimension2D();
42 }
43
44 /// Creates a new instance of Rectangle at position (x, y) and with
45 /// predefine dimension
46 ///
47 /// #### Parameters
48 ///
49 /// - `x`: the x coordinate of the rectangle
50 ///
51 /// - `y`: the y coordinate of the rectangle
52 ///
53 /// - `size`: the `Dimension` of the rectangle
54 public Rectangle2D(double x, double y, Dimension2D size) {
55 this.x = x;
56 this.y = y;
57 this.size = size;
58 }
59
60 /// Creates a new instance of Rectangle at position (x, y) and with
61 /// predefine width and height
62 ///
63 /// #### Parameters
64 ///
65 /// - `x`: the x coordinate of the rectangle
66 ///
67 /// - `y`: the y coordinate of the rectangle
68 ///
69 /// - `w`: the width of the rectangle
70 ///
71 /// - `h`: the height of the rectangle
72 public Rectangle2D(double x, double y, double w, double h) {
73 this.x = x;
74 this.y = y;
75 this.size = new Dimension2D(w, h);
76 }
77
78 /// A copy Constructor
79 ///
80 /// #### Parameters
81 ///
82 /// - `rect`: the Rectangle to copy
83 public Rectangle2D(Rectangle2D rect) {
84 this(rect.getX(), rect.getY(),
85 rect.getSize().getWidth(), rect.getSize().getHeight());
86 }
87
88 /// Checks wheather the 2nd rectangle is contained in the first rectangle
89 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected