Hallo![]()
Ebenfalls wollte ich fragen ob mir jemand doch einen Quellcode zeigen könnte bei dem ein Kreis gezeichnet wird.
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame();
JPanel panel = new JPanel(){
{
setSize(500, 500);
setPreferredSize(getSize());
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawOval(200, 200, 100, 100);
}
};
frame.add(panel);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
Java:@Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawOval(200, 200, 100, 100);
Und zum Kreis zeichnen:
Gibt es da eine noch kürzere, einfacherere Methode oder ist das schon das mindeste?![]()
Sieht nämlich immernoch recht kompliziert aus ^^