Java:
import java.awt.*;
import javax.swing.*;
public class Skalar extends JFrame{
private final Container cp = this.getContentPane() ;
public static void main(String[] args) {
new Skalar();
}
public Skalar() {
super("Skalare und Winkel");
this.setLayout(null);
this.setSize(480, 400);
this.setLocation(50, 50);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setVisible(true);
init();
}
private void init() {
System.out.print("width:" + cp.getWidth() + "height" + cp.getHeight());
cp.add(new View(this));
}
public Container getCp() {
return cp;
}
}
import java.awt.*;
import javax.swing.*;
public class View extends JPanel {
private Skalar frame;
public View(Skalar frame) {
this.frame=frame;
this.setSize(frame.getCp().getWidth(), frame.getHeight());
System.out.print("\nwidth:" + frame.getCp().getWidth() + "height" + frame.getCp().getHeight());
}
public void paintComponent(Graphics g) {
g.drawString("test", 20, 20);
g.setColor(Color.BLUE);
g.fillRect( 0, 0, frame.getWidth(), frame.getCp().getHeight() );
}
}
Die Hoehe der Pane kann von mir nicht geändert werden sie geht über die Goesse des Frames hinaus hat jemand eine Idee was ich falsch mache ???:L .