• Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiler output to troubleshoot  RSS feed

 
Patrick Smith
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, here's greenhorn nbr1!
I would like to compile the following code, but get 5 errors.
Here's the code, then follows the compiler's output. Can you help me to troubleshoot?
Thanks, Patrick

Code:
import java.awt.*;
import javax.swing.*;

class MeinZeichenPanel extends JPanel {
public void paintComponent(Graphics g);
g.setColor(Color.orange);
g.fillRect(20,50,100,100);
} // end of PaintComponent
} // end of class MeinZeichenPanel

Compiler Output:

MeinZeichenPanel.java:6: <identifier> expected
g.setColor(Color.orange);
^
MeinZeichenPanel.java:6: <identifier> expected
g.setColor(Color.orange);
^
MeinZeichenPanel.java:7: <identifier> expected
g.fillRect(20,50,100,100);
^
MeinZeichenPanel.java:7: illegal start of type
g.fillRect(20,50,100,100);
^
MeinZeichenPanel.java:9: class, interface, or enum expected
} // end of class MeinZeichenPanel→
^
5 errors
 
ahmed yehia
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simply add a brace instead of the semi colon like that:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!