Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Graphics;
- public class Arrow implements BasicPainter {
- @Override
- public void paint(Graphics g, int x, int y, int width, int height, boolean fill) {
- int[] xovi = {x, (x + width / 2), (x + width / 2), x + width, (x + width / 2), (x + width / 2), x};
- int[] yoni = {y, y, (y - height / 4), (y + height / 4), (y + 3 * height / 4), (y + height / 2), (y + height / 2)};
- if (fill)
- g.fillPolygon(xovi,yoni,7);
- else
- g.drawPolygon(xovi,yoni,7);
- }
- }
- import java.awt.Graphics;
- public class Circle implements BasicPainter {
- @Override
- public void paint(Graphics g, int x, int y, int width, int height, boolean fill) {
- if (!fill)
- g.drawOval(x, y, width, height);
- else
- g.fillOval(x, y, width, height);
- }
- }
- import java.awt.Graphics;
- public class Triangle implements BasicPainter {
- @Override
- public void paint(Graphics g, int x, int y, int width, int height, boolean fill) {
- if (!fill) {
- g.drawLine(x, y, x + (width / 2), y + height);
- g.drawLine(x + (width / 2), y + height, x - (width / 2), y + height);
- g.drawLine(x - (width / 2), y + height, x, y);
- } else {
- int[] xovi = {x, x + (width / 2), x - (width / 2)};
- int[] yoni = {y, y + height, y + height};
- g.fillPolygon(xovi, yoni, 3);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement