import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JWindow; import javax.swing.SwingUtilities; public class FensterTypen { public static void main(String[] args) { SwingUtilities.invokeLater(() -> new FrameFenster()); SwingUtilities.invokeLater(() -> new WindowFenster()); SwingUtilities.invokeLater(() -> new DialogFenster()); } } class FrameFenster { public FrameFenster() { JFrame frame = new JFrame("JFrame-Fenster"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 300); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setLocationRelativeTo(null); frame.add(new JLabel("JFrame-Fenster")); frame.setVisible(true); } } class WindowFenster { public WindowFenster() { JWindow window = new JWindow(); window.setSize(300, 300); window.setLocation(100, 100); window.add(new JLabel("JWindow-Fenster")); window.setVisible(true); } } class DialogFenster { public DialogFenster() { JDialog dialog = new JDialog(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setSize(300, 300); dialog.setLocation(300, 200); dialog.setTitle("JDialog-Fenster"); dialog.add(new JLabel("JDialog-Fenster")); dialog.setVisible(true); } }