Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.*;
- public class Rectangle extends JPanel {
- JFrame frame;
- public void fireUpScreen() {
- frame = new JFrame();
- frame.setVisible(true);
- frame.setSize(600,600);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.add(this);
- }
- public void paintComponent(Graphics g) {
- g.setColor(Color.BLUE);
- g.fillRect(0,0,200,100);
- }
- public static void main(String[] args) {
- Rectangle go = new Rectangle();
- go.fireUpScreen();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement