Hallo,
ich habe bezüglich dieser Frage schon im Forum gesucht, wollte aber nicht alle 6 Seiten durchgehen. Ich hoffe also, das so eine Frage nicht schonmal aufkam:
Ich versuche gerade ein Beispielprogramm für einen JInternalFrame zu schreiben. Das funktioniert aber nicht so ganz...
Fehler:
Wo ist mein Fehler?
MfG
DeeDee0815
ich habe bezüglich dieser Frage schon im Forum gesucht, wollte aber nicht alle 6 Seiten durchgehen. Ich hoffe also, das so eine Frage nicht schonmal aufkam:
Ich versuche gerade ein Beispielprogramm für einen JInternalFrame zu schreiben. Das funktioniert aber nicht so ganz...
Code:
import java.awt.Frame;
import javax.swing.DefaultDesktopManager;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
class DesktopFrame
extends Frame
{
private static final long serialVersionUID = 1L;
private JDesktopPane desk;
public DesktopFrame()
{
super("DesktopFrame");
this.desk = new JDesktopPane();
desk.setDesktopManager(new DefaultDesktopManager());
setContentPane(desk);
}
public void addChild(JInternalFrame child, int x, int y)
{
child.setLocation(x, y);
child.setSize(200, 150);
child.setDefaultCloseOperation(JInternalFrame.EXIT_ON_CLOSE);
desk.add(child);
child.setVisible(true);
}
}
class ChildFrame
extends JInternalFrame
{
private static final long serialVersionUID = 1L;
public ChildFrame(String title)
{
super("Kindfenster " + title, true, true);
setIconifiable(true);
setMaximizable(true);
}
}
public class DesktopFrameTest
{
public static void main(String[] args)
{
DesktopFrame desktop = new DesktopFrame();
desktop.setLocation(100, 100);
desktop.setSize(100, 100);
desktop.setVisible(true);
desktop.addChild(new ChildFrame("1"), 10, 10);
desktop.addChild(new ChildFrame("2"), 20, 20);
}
}
Fehler:
Code:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method setContentPane(JDesktopPane) is undefined for the type DesktopFrame
at DesktopFrame.<init>(DesktopFrameTest.java:18)
at DesktopFrameTest.main(DesktopFrameTest.java:48)
Wo ist mein Fehler?
MfG
DeeDee0815