I have a JFrame generated in my main method which contains a button that opens JDialogs every time it is pressed. The problem I'm having is that the JDialog is not visible in the taskbar, and the solutions I find on internet are when you generate a JDialog in your main.
How can I do to make every new window appear in my Windows taskbar?
For reference, my main looks like that:
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Main frame = new Main();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Main() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JButton btnNouvelleFentre = new JButton("Nouvelle fen\u00EAtre");
btnNouvelleFentre.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Chat dlg = new Chat();
}
});
contentPane.add(btnNouvelleFentre, BorderLayout.SOUTH);
}
As you can see, I'm creating an instance of the class Chat, which extends JDialog. A new window is created, but none of them are in the taskbar.