Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.event.ActionEvent;
- import javax.swing.JComboBox;
- abstract class Shape {
- abstract void draw(Graphics g);
- int x, y, diameter;
- Color color = Color.PINK;
- public Shape(int x, int y, int diameter) {
- this.x = x;
- this.y = y;
- this.diameter = diameter;
- }
- public void colorShape(Color color) {
- this.color = color;
- }
- void moveShape(int x2, int y2) {
- x = x + x2;
- y = y + y2;
- }
- boolean checkForPoint(int xcoord, int ycoord) {
- if (xcoord >= x && xcoord < x + diameter && ycoord >= y && ycoord < y + diameter)
- return true;
- else
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment