advictoriam

Untitled

Nov 16th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import javax.swing.JComponent;
  2. import java.awt.Graphics;
  3. import java.awt.Graphics2D;
  4. import java.awt.Rectangle;
  5.  
  6. public class IntersectionComponent extends JComponent
  7. {
  8.    public void paintComponent(Graphics g)
  9.    {
  10.       Graphics2D g2 = (Graphics2D) g;
  11.       Rectangle box1 = new Rectangle(5, 10, 100, 120);
  12.       Rectangle box2 = new Rectangle(50, 60, 100, 120);
  13.       Rectangle box3 = new Rectangle(50, 60, 55, 70);
  14.      
  15.       g2.draw(box1);
  16.       g2.draw(box2);
  17.       g2.fill(box3);
  18.    }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment