Advertisement
Guest User

GraphicsTile

a guest
Sep 5th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Dimension;
  3. import java.awt.Graphics;
  4. import java.awt.GridLayout;
  5.  
  6. @SuppressWarnings("serial")
  7. public class GraphicsTile extends JPanel {
  8. public static final Dimension SIZE = new Dimension(140, 140);
  9. public static final GridLayout MGR = new GridLayout(2, 2);
  10.  
  11. public GraphicsTile() {
  12. super();
  13. setLayout(MGR);
  14.  
  15. add(new CirclePanel());
  16. add(new CirclePanel());
  17. add(new CirclePanel());
  18. add(new CirclePanel());
  19.  
  20. }
  21.  
  22. @Override
  23. public Dimension getPreferredSize() {
  24. return SIZE;
  25. }
  26.  
  27. @Override
  28. protected void paintComponent(Graphics g) {
  29. super.paintComponent(g);
  30. g.setColor(Color.GREEN);
  31. g.fillRect(0, 0, 140, 140);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement