Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package canvas;
  2.  
  3. import javax.swing.JPanel;
  4. import listener.Listener;
  5. import java.awt.Color;
  6. import java.awt.Graphics;
  7. import java.awt.event.MouseEvent;
  8. import shape.*;
  9.  
  10. public class Rityta extends JPanel {
  11.  
  12. private int x, y;
  13. private Graphics g;
  14. private Modell ritModell;
  15. private int getshape;
  16.  
  17. public Rityta() {
  18. this.addMouseListener(new Listener(this));
  19. this.setVisible(true);
  20. this.setBackground(Color.WHITE);
  21.  
  22. }
  23.  
  24. public void paintComponent(Graphics g) {
  25. //case 0
  26. ritModell.addShape(new Circle(x, y, Color.BLACK, 25, 25));
  27. //case 1
  28. ritModell.addShape(new Rectangle(x, y, Color.BLACK, 25, 25));
  29. //case 2
  30. }
  31.  
  32. public void clickAt(int x, int y) {
  33. this.x = x;
  34. this.y = y;
  35.  
  36. repaint();
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement