Skip to content

Instantly share code, notes, and snippets.

@Girmrad
Created September 25, 2011 22:01
Show Gist options
  • Save Girmrad/1241225 to your computer and use it in GitHub Desktop.
Save Girmrad/1241225 to your computer and use it in GitHub Desktop.
import java.awt.Graphics;
import javax.swing.JComponent;
import javax.swing.JFrame;
class rect extends JComponent {
public static void main(String[] args) {
public void paint(Graphics g) {
g.drawRect (10, 10, 200, 200);
}
}
}
class DrawRect {
public static void main(String[] a) {
JFrame window = new JFrame();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setBounds(30, 30, 300, 300);
window.getContentPane().add(new MyCanvas());
window.setVisible(true);
}
}
@Girmrad
Copy link
Author

Girmrad commented Sep 25, 2011

rect.java:10: error: illegal start of expression
public void paint(Graphics g) {
^
rect.java:10: error: illegal start of expression
public void paint(Graphics g) {
^
rect.java:10: error: ';' expected
public void paint(Graphics g) {
^
rect.java:10: error: ';' expected
public void paint(Graphics g) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment