Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- /**
- *
- * @author IT Academy
- */
- public class Main extends JPanel {
- public static void main(String args[]) {
- JFrame f = new JFrame("Kreslime v Jave");
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Main d = new Main();
- f.add(d);
- f.setSize(500, 280);
- f.setVisible(true);
- }
- @Override
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- this.setBackground(Color.WHITE);
- g.setColor(new Color(125,125,125));
- g.drawLine(10, 10, 100, 30);
- g.setColor(Color.BLUE);
- g.drawRect(10, 50, 100, 30);
- g.setColor(Color.ORANGE);
- g.fill3DRect(10, 90, 100, 30, false);
- g.setColor(Color.cyan);
- g.drawOval(10, 130, 100, 30);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment