תנסה את זה
package shapes; import java.awt.*; import javax.swing.JPanel; public class shape extends Object { private int x1, x2; private int y1, y2; private int size; private Color colorValue; private boolean fill; public shape() { x1 = x2 = 0; y1 = y2 = 0; size = 0; colorValue = Color.blue; fill = false; } public shape ( int x1, int y1, int x2, int y2 ) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } public void setPos ( int x1, int y1, int x2, int y2 ) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } public void setSize ( int size ) { this.size = size; } public void setColor ( Color color ) { colorValue = color; } public void setFill ( boolean isFill ) { fill = isFill; } public int getX1 () { return x1; } public int getY1 () { return y1; } public int getX2 () { return x2; } public int getY2 () { return y2; } public void drawShape ( Graphics g ) { } }