Thursday, December 20, 2012

Java Tutorial 27 Source Code

import java.awt.Graphics; import javax.swing.JFrame; public class Tutorial extends JFrame { public Tutorial() { setTitle("Tutorial"); setSize(400, 400); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void paint(Graphics g) { g.drawRect(480, 480, 200, 100); g.fillRect(240, 240, 200, 100); } public static void main(String[] args) { Tutorial t = new Tutorial(); t.paint(null); // Not a proper way, but it still works. } }

2 comments:

  1. hi good tutoriel please i have a project detect a rectangle in video can you help me my email yousfi_samira@hotmail.fr thank

    ReplyDelete
  2. How do I make this compatible with JFrame?

    ReplyDelete