Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JComponent;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Rectangle;
- public class CheckerBoardComponent extends JComponent
- {
- public void paintComponent(Graphics g)
- {
- Graphics2D g2 = (Graphics2D) g;
- g.setColor(Color.RED);
- g.fillRect(0, 0, 50, 50);
- g.fillRect(100, 0, 50, 50);
- g.fillRect(0, 100, 50, 50);
- g.fillRect(50, 50, 50, 50);
- g.fillRect(100, 100, 50, 50);
- }
- }
Add Comment
Please, Sign In to add comment