Warum läuft die Hauptmethode nicht?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Warum läuft die Hauptmethode nicht?

by Anonymous » Yesterday, 00:32

Ein bisschen verwirrt über die öffentliche statische Leere -Hauptmethode in Java und hoffte, dass jemand helfen könnte. Ich habe zwei Klassen < /p>

public class theGame {
public static void main(String[] args) {
lineTest gameBoard = new lineTest();
}
< /code>

und < /p>

public class lineTest extends JPanel {

public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.red);
g2d.drawLine(100, 100, 100, 200);
}

public static void main(String[] args) {
lineTest points = new lineTest();
JFrame frame = new JFrame("Points");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(points);
frame.setSize(250, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
< /code>

Mein Programm zeichnet die Zeile leider nicht. Ich versuche herauszufinden, warum die Hauptmethode in der Linetest -Klasse nicht eingeht?>

Top