package rechteck;import java.awt.*;public class Rect extends Frame { private int x; private int y; private int w; private int h; public Rect(int x1, int x2, int y1, int y2) { super(); this.x = x1; this.w = x2 - x1; this.y = y1; this.h = y2 - y1; this.setSize(400, 400); this.setVisible(true); this.repaint(); } public Rect(int w, int h) { this(0, w, 0, h); } public void paint(Graphics g) { g.setColor(Color.blue); g.fillRect(x, y, w, h); } public void move(int x, int y) { this.x += x; this.y += y; repaint(); } public boolean isInside(int x, int y) { return ((x >= this.x) && (x <= (this.w + this.x)) && (y >= this.y) && (y <= (this.h + this.y)))? true: false; } }