I have tried in many ways to add an internal frame to my existing one. I have tried with and without JPanel. But nothing worked and I don´t have a clue why. Anyone?
public class Menu_new extends JFrame{
private BufferedImage background = null;
public Menu_new() {
try {
background = ImageIO.read(new File("pics_1/hallo.jpg"));
} catch (IOException e) {
e.printStackTrace();
}
JDesktopPane desktop = new JDesktopPane();
JInternalFrame inside = new JInternalFrame(("Data"), true, true, true, true);
desktop.add(inside);
inside.setBounds(50, 50, 300, 500);
inside.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
inside.setVisible(true);
JLabel label = new JLabel("Your name");
inside.add(label);
JTextField text = new JTextField(10);
inside.add(text);
Icon icon = new ImageIcon("pics_1/Button.png");
JButton start = new JButton(icon);
start.setBorder(BorderFactory.createEmptyBorder());
inside.add(start);
inside.moveToFront();
this.add(desktop);
}
public void paintComponent(Graphics g) {
g.drawImage(background, 0, 0, this);
}
}