G
Guest
Gast
Code:
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.*;
public class Graph extends JFrame{
private JLabel infoLabel = new JLabel();
private JButton start = new JButton("start");
public Graph(){
super("Graph Demonstationsprogramm");
this.setSize(500,500);
this.setVisible(true);
this.setResizable(false);
this.setBackground(Color.WHITE);
getContentPane().setLayout(null);
start.setBounds(100,100,100,100);
getContentPane().add(start);
}
public void paint(Graphics g){
// Kreis 1 und 2
g.drawOval(50,50,50,50);
g.drawOval(150,50,50,50);
g.drawLine(100,75,150,75);
g.drawString("A",75,75);
// Kreis 2 und 3
g.drawOval(250,50,50,50);
g.drawLine(200,75,250,75);
}
public static void main(String[] args) {
Graph frame = new Graph();
}
}
Wieso geht das nicht ?