Modaler Dialog wird nicht angezeigt

neela

Bekanntes Mitglied
Hallo

ich frage mich gerade warum mein Dialog nicht angezeigt wird.
Habe schon öfters Modale Dialoge verwendet, welche alle auch funktioniert haben.
Ob wohl ich den jetzigen genaus so aufgebaut habe wird er mir nicht angezeigt.
Aber alle SysOut die ich Testweise im Dialog eingefügt habe werden ausgegeben
Füge ich nach dem packen
Java:
set.Visible(true)
(was meines Erachtens nicht nötig ist ) ein wird er mir angezeigt aber die Listener von den Buttons werden nie aufgerufen

Zunächst einmal der Aufruf des Dialoges
Java:
GebDialog  gebdia = new GebDialog(hauptfenster,
						true);

und nun der eigentliche Dialog
Java:
public GebDialog(JFrame owner, boolean modal) {

		super(owner, modal);
		
		initComponents();
		//this.hauptfenster = hauptfenster;
		this.okBtn.addActionListener(new OkListener());
		this.endeBtn.addActionListener(new EndeListener());
	}

Die Gestaltung des Dialogs

Java:
private void initComponents() {
System.out.println("b");
		setTitle("Ver\u00e4nderung von Geb\u00e4udedaten");
		jLabel1
				.setText("Bitte alle n\u00f6tigen Daten f\u00fcr die \u00c4nderung von Geb\u00e4udedaten einf\u00fcgen");

		gebTab.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null } },
				new String[] { "Akademischer Grad", "Vorname", "Nachname",
						"Straße", "Hausnummer ", "Postleitzahl", "Ort",
						"Gemarkung", "Flurstück" }));
		jScrollPane1.setViewportView(gebTab);

		endeBtn.setText("Abbruch");

		okBtn.setText("Ok");

		GroupLayout layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup().addGap(18, 18, 18).addComponent(
						jLabel1).addContainerGap(551, Short.MAX_VALUE))
				.addGroup(
						layout.createSequentialGroup().addGap(308, 308, 308)
								.addComponent(endeBtn).addPreferredGap(
										LayoutStyle.ComponentPlacement.RELATED,
										275, Short.MAX_VALUE).addComponent(
										okBtn).addGap(200, 200, 200)).addGroup(
						layout.createSequentialGroup().addContainerGap()
								.addComponent(jScrollPane1,
										GroupLayout.DEFAULT_SIZE, 885,
										Short.MAX_VALUE).addContainerGap()));
		layout.setVerticalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup().addGap(22, 22, 22).addComponent(
						jLabel1).addGap(25, 25, 25).addComponent(jScrollPane1,
						GroupLayout.PREFERRED_SIZE, 171,
						GroupLayout.PREFERRED_SIZE).addPreferredGap(
						LayoutStyle.ComponentPlacement.RELATED, 68,
						Short.MAX_VALUE).addGroup(
						layout.createParallelGroup(
								GroupLayout.Alignment.BASELINE).addComponent(
								endeBtn).addComponent(okBtn))
						.addGap(24, 24, 24)));
			pack();

		
	}

Einer von den beiden genutzen Listener

Java:
	public class OkListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			setVisible(false);

			dispose();
		}
	}

Ich währe euch dankbar wenn Ihr mit vlt verraten Könntet was ich falsch gemacht habe
 
hier ist nochmal der Gesamte GebäudeDialog

Java:
package nutzerschnittstelle;


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JDialog;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.LayoutStyle;
import javax.swing.table.DefaultTableModel;

public class GebDialog extends JDialog {

	private JLabel jLabel1 = new JLabel();
	private JScrollPane jScrollPane1 = new JScrollPane();
	private JTable gebTab = new JTable();
	private JButton endeBtn = new JButton();
	private JButton okBtn = new JButton();
	Hauptfenster hauptfenster;

	public GebDialog(JFrame owner, boolean modal) {

		super(owner, modal);
		
		initComponents();
		//this.hauptfenster = hauptfenster;
		this.okBtn.addActionListener(new OkListener());
		this.endeBtn.addActionListener(new EndeListener());
	}

	private void initComponents() {
System.out.println("b");
		setTitle("Ver\u00e4nderung von Geb\u00e4udedaten");
		jLabel1
				.setText("Bitte alle n\u00f6tigen Daten f\u00fcr die \u00c4nderung von Geb\u00e4udedaten einf\u00fcgen");

		gebTab.setModel(new DefaultTableModel(new Object[][] {
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null },
				{ null, null, null, null, null, null, null, null, null } },
				new String[] { "Akademischer Grad", "Vorname", "Nachname",
						"Straße", "Hausnummer ", "Postleitzahl", "Ort",
						"Gemarkung", "Flurstück" }));
		jScrollPane1.setViewportView(gebTab);

		endeBtn.setText("Abbruch");

		okBtn.setText("Ok");

		GroupLayout layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup().addGap(18, 18, 18).addComponent(
						jLabel1).addContainerGap(551, Short.MAX_VALUE))
				.addGroup(
						layout.createSequentialGroup().addGap(308, 308, 308)
								.addComponent(endeBtn).addPreferredGap(
										LayoutStyle.ComponentPlacement.RELATED,
										275, Short.MAX_VALUE).addComponent(
										okBtn).addGap(200, 200, 200)).addGroup(
						layout.createSequentialGroup().addContainerGap()
								.addComponent(jScrollPane1,
										GroupLayout.DEFAULT_SIZE, 885,
										Short.MAX_VALUE).addContainerGap()));
		layout.setVerticalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup().addGap(22, 22, 22).addComponent(
						jLabel1).addGap(25, 25, 25).addComponent(jScrollPane1,
						GroupLayout.PREFERRED_SIZE, 171,
						GroupLayout.PREFERRED_SIZE).addPreferredGap(
						LayoutStyle.ComponentPlacement.RELATED, 68,
						Short.MAX_VALUE).addGroup(
						layout.createParallelGroup(
								GroupLayout.Alignment.BASELINE).addComponent(
								endeBtn).addComponent(okBtn))
						.addGap(24, 24, 24)));
			pack();

		
	}

	public class OkListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			setVisible(false);

			dispose();
		}
	}

	public class EndeListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {

			setVisible(false);
			hauptfenster.setGebCheck(false);
			dispose();
		}
	}

}

Den Aufruf welchen ich nutze hab ich oben bereits gepostet.
hauptfenster ist bei mir das Hauptframe
 
Die Klasse Hauptframe etwas eingekürzt

Java:
package nutzerschnittstelle;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.File;

import javax.swing.ButtonGroup;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.filechooser.FileFilter;

import fachlogik.ReadXml;

public class Hauptfenster extends JFrame {
	private static final long serialVersionUID = 4719318418711858400L;
	Hauptfenster hauptfenster = this;
	JTextField xmlField = new JTextField();
	JTextField saveField = new JTextField();
	JButton startBtn = new JButton();
	JButton endeBtn = new JButton();
	JButton xmlBtn = new JButton();
	JButton saveBtn = new JButton();
	JCheckBox dateCheck = new JCheckBox();
	JRadioButton todayRadio = new JRadioButton();
	JRadioButton otherDay = new JRadioButton();
	JTextField dateField = new JTextField();
	JCheckBox faxCheck = new JCheckBox();
	JCheckBox gebCheck = new JCheckBox();
	JTextField faxField = new JTextField();
	JTextField beginnField = new JTextField();
	JTextField endeField = new JTextField();
	JTextField erreichbarField = new JTextField();
	JLabel jLabel5 = new JLabel();
	JTextField funktionField = new JTextField();

	public Hauptfenster() {
		initComponents();
	
		this.gebCheck.addItemListener(new GebListener());
	

		
	}

	public JButton getStartBtn() {
		return startBtn;
	}

	public void setStartBtn(JButton startBtn) {
		this.startBtn = startBtn;
	}

	public boolean getGebCheck() {
		return gebCheck.isSelected();
	}

	public void setGebCheck(boolean gebCheck) {
		
		this.gebCheck.setSelected(gebCheck);
	}

	
	private void initComponents() {
		JLabel jLabel1 = new JLabel();
		JLabel jLabel2 = new JLabel();
		JLabel jLabel4 = new JLabel();
		JLabel jLabel6 = new JLabel();
		JLabel jLabel7 = new JLabel();
		JLabel jLabel8 = new JLabel();
		JLabel jLabel9 = new JLabel();
		JLabel jLabel10 = new JLabel();
		JPanel jPanel1 = new JPanel();
		JPanel jPanel2 = new JPanel();
				
		ButtonGroup dategroup = new ButtonGroup();
		dategroup.add(todayRadio);
		dategroup.add(otherDay);
		String path = (System.getProperty("user.dir")) + "\\wappenbunt.jpg";

		if (path != null)
			hauptfenster.setIconImage(new ImageIcon(path).getImage());
		hauptfenster.setResizable(false);
		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("Mitteilungsschreiben erstellen");
		setBackground(new java.awt.Color(204, 255, 255));
		getAccessibleContext().setAccessibleName(
				"Mitteileungsschreiben erstellen");

		startBtn.setText("Start");

		endeBtn.setText("Abbruch");

		xmlBtn.setText("Suchen");

		saveBtn.setText("Speichern unter");

		jLabel1.setText("Beteiligte XML");

		jLabel2.setText("Mittelungsschreiben");

		jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPanel1.setName("Bearbeiterdaten");
		dateCheck.setText("Datum");
		dateCheck.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0,
				0, 0));
		dateCheck.setMargin(new java.awt.Insets(0, 0, 0, 0));

		todayRadio.setText("aktuelle Datum");
		todayRadio.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0,
				0, 0));
		todayRadio.setMargin(new java.awt.Insets(0, 0, 0, 0));

		otherDay.setText("RadioButton2");
		otherDay.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0,
				0));
		otherDay.setMargin(new java.awt.Insets(0, 0, 0, 0));

		faxCheck.setText("Fax");
		faxCheck.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0,
				0));
		faxCheck.setMargin(new java.awt.Insets(0, 0, 0, 0));

		GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
		jPanel1.setLayout(jPanel1Layout);
		jPanel1Layout
				.setHorizontalGroup(jPanel1Layout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addComponent(dateCheck)
														.addComponent(faxCheck))
										.addGap(38, 38, 38)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING,
																false)
														.addGroup(
																jPanel1Layout
																		.createSequentialGroup()
																		.addComponent(
																				otherDay,
																				GroupLayout.PREFERRED_SIZE,
																				13,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				dateField,
																				GroupLayout.PREFERRED_SIZE,
																				90,
																				GroupLayout.PREFERRED_SIZE))
														.addComponent(faxField)
														.addComponent(
																todayRadio,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE))
										.addContainerGap(18, Short.MAX_VALUE)));
		jPanel1Layout
				.setVerticalGroup(jPanel1Layout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addGroup(
																jPanel1Layout
																		.createSequentialGroup()
																		.addGap(
																				26,
																				26,
																				26)
																		.addComponent(
																				todayRadio)
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				jPanel1Layout
																						.createParallelGroup(
																								GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								dateField,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								otherDay)))
														.addGroup(
																jPanel1Layout
																		.createSequentialGroup()
																		.addGap(
																				20,
																				20,
																				20)
																		.addComponent(
																				dateCheck)))
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addComponent(faxCheck)
														.addComponent(
																faxField,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap()));

		jLabel4.setText("Daten des Bearbeiters");

		jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jLabel6.setText("Einsichtnahme:");

		jLabel7.setText("von");

		jLabel8.setText("bis");

		jLabel9.setText("Erreichbar in der Zeit:");

		jLabel10.setText("Funktion des Bearbeiters");

		GroupLayout jPanel2Layout = new GroupLayout(jPanel2);
		jPanel2.setLayout(jPanel2Layout);
		jPanel2Layout
				.setHorizontalGroup(jPanel2Layout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel2Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel2Layout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addComponent(
																erreichbarField,
																GroupLayout.DEFAULT_SIZE,
																188,
																Short.MAX_VALUE)
														.addComponent(jLabel6)
														.addComponent(jLabel10)
														.addComponent(
																funktionField,
																GroupLayout.DEFAULT_SIZE,
																188,
																Short.MAX_VALUE)
														.addGroup(
																jPanel2Layout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel7)
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED,
																				GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				beginnField,
																				GroupLayout.PREFERRED_SIZE,
																				65,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				jLabel8,
																				GroupLayout.PREFERRED_SIZE,
																				32,
																				GroupLayout.PREFERRED_SIZE)
																		.addGap(
																				0,
																				0,
																				0)
																		.addComponent(
																				endeField,
																				GroupLayout.PREFERRED_SIZE,
																				65,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED))
														.addComponent(jLabel9))
										.addContainerGap()));
		jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addGroup(
				jPanel2Layout.createSequentialGroup().addContainerGap()
						.addComponent(jLabel6).addPreferredGap(
								LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(
								jPanel2Layout.createParallelGroup(
										GroupLayout.Alignment.BASELINE)
										.addComponent(jLabel7).addComponent(
												beginnField,
												GroupLayout.PREFERRED_SIZE,
												GroupLayout.DEFAULT_SIZE,
												GroupLayout.PREFERRED_SIZE)
										.addComponent(endeField,
												GroupLayout.PREFERRED_SIZE,
												GroupLayout.DEFAULT_SIZE,
												GroupLayout.PREFERRED_SIZE)
										.addComponent(jLabel8)).addGap(15, 15,
								15).addComponent(jLabel9).addPreferredGap(
								LayoutStyle.ComponentPlacement.RELATED)
						.addComponent(erreichbarField,
								GroupLayout.PREFERRED_SIZE,
								GroupLayout.DEFAULT_SIZE,
								GroupLayout.PREFERRED_SIZE).addPreferredGap(
								LayoutStyle.ComponentPlacement.RELATED)
						.addComponent(jLabel10).addPreferredGap(
								LayoutStyle.ComponentPlacement.RELATED)
						.addComponent(funktionField,
								GroupLayout.PREFERRED_SIZE,
								GroupLayout.DEFAULT_SIZE,
								GroupLayout.PREFERRED_SIZE).addContainerGap(
								GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

		jLabel5.setText("Daten der Offenlegung");

		gebCheck.setText("Nur Geb\u00e4ude\u00e4nderung");
		gebCheck.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0,
				0));
		gebCheck.setMargin(new java.awt.Insets(0, 0, 0, 0));

		GroupLayout layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout
				.setHorizontalGroup(layout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								GroupLayout.Alignment.TRAILING,
								layout
										.createSequentialGroup()
										.addGap(42, 42, 42)
										.addGroup(
												layout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addGroup(
																layout
																		.createSequentialGroup()
																		.addGroup(
																				layout
																						.createParallelGroup(
																								GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jLabel1)
																						.addGroup(
																								layout
																										.createParallelGroup(
																												GroupLayout.Alignment.LEADING,
																												false)
																										.addComponent(
																												jLabel2)
																										.addComponent(
																												saveField)
																										.addComponent(
																												xmlField,
																												GroupLayout.PREFERRED_SIZE,
																												283,
																												GroupLayout.PREFERRED_SIZE)))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED,
																				58,
																				Short.MAX_VALUE)
																		.addGroup(
																				layout
																						.createParallelGroup(
																								GroupLayout.Alignment.LEADING)
																						.addComponent(
																								xmlBtn)
																						.addComponent(
																								saveBtn))
																		.addGap(
																				11,
																				11,
																				11))
														.addGroup(
																layout
																		.createSequentialGroup()
																		.addGroup(
																				layout
																						.createParallelGroup(
																								GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jLabel4)
																						.addGroup(
																								layout
																										.createSequentialGroup()
																										.addGap(
																												90,
																												90,
																												90)
																										.addComponent(
																												endeBtn))
																						.addComponent(
																								jPanel1,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								gebCheck))
																		.addGroup(
																				layout
																						.createParallelGroup(
																								GroupLayout.Alignment.LEADING)
																						.addGroup(
																								layout
																										.createSequentialGroup()
																										.addGap(
																												87,
																												87,
																												87)
																										.addComponent(
																												startBtn))
																						.addGroup(
																								layout
																										.createSequentialGroup()
																										.addGap(
																												23,
																												23,
																												23)
																										.addGroup(
																												layout
																														.createParallelGroup(
																																GroupLayout.Alignment.LEADING)
																														.addComponent(
																																jLabel5)
																														.addComponent(
																																jPanel2,
																																GroupLayout.PREFERRED_SIZE,
																																GroupLayout.DEFAULT_SIZE,
																																GroupLayout.PREFERRED_SIZE))))))
										.addGap(37, 37, 37)));
		layout
				.setVerticalGroup(layout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(jLabel1)
										.addGap(4, 4, 4)
										.addGroup(
												layout
														.createParallelGroup(
																GroupLayout.Alignment.BASELINE)
														.addComponent(xmlBtn)
														.addComponent(
																xmlField,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(jLabel2)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												layout
														.createParallelGroup(
																GroupLayout.Alignment.BASELINE)
														.addComponent(
																saveField,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(saveBtn))
										.addGap(23, 23, 23)
										.addGroup(
												layout
														.createParallelGroup(
																GroupLayout.Alignment.TRAILING)
														.addGroup(
																layout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel4)
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				jPanel1,
																				GroupLayout.PREFERRED_SIZE,
																				127,
																				GroupLayout.PREFERRED_SIZE))
														.addGroup(
																layout
																		.createSequentialGroup()
																		.addGroup(
																				layout
																						.createParallelGroup(
																								GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								jLabel5,
																								GroupLayout.PREFERRED_SIZE,
																								14,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								gebCheck))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				jPanel2,
																				GroupLayout.PREFERRED_SIZE,
																				GroupLayout.DEFAULT_SIZE,
																				GroupLayout.PREFERRED_SIZE)))
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												layout
														.createParallelGroup(
																GroupLayout.Alignment.BASELINE)
														.addComponent(endeBtn)
														.addComponent(startBtn))
										.addContainerGap(
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)));
		pack();
	}

	
	public class DateListener implements ItemListener {
		public void itemStateChanged(ItemEvent ie) {

			if (getOtherDay() == false) {
				if (getDateCheck() == true) {
					todayRadio.setSelected(true);
				}
			}
		}
	}
	
	public class GebListener implements ItemListener {
		public void itemStateChanged(ItemEvent ie) {

			if (getGebCheck() == true) {
				System.out.println("blubb2");
				 new GebDialog(hauptfenster,
						true);
				
				}
			
		}
	}


	public String getSaveFile() {
		return saveField.getText();
	}

	/**
	 * Zurückgegeben wird ein Boolean Wert ob ein Datum in die Dokumente
	 * eingefügt werden soll.
	 * 
	 * @return boolean
	 */
	public boolean getDateCheck() {
		return dateCheck.isSelected();
	}

	/**
	 * Gibt zurück ob das aktuelle Datum verwendet werden soll
	 * 
	 * @return boolean
	 */
	public boolean getTodayRadio() {
		return todayRadio.isSelected();
	}

	/**
	 * Gibt zurück ob ein anderes Datum verwendet werden soll
	 * 
	 * @return boolean
	 */
	public boolean getOtherDay() {

		return otherDay.isSelected();
	}

	/**
	 * Überprüft ob die Faxnummer in den zu erstellenden Dokumenten eingefügt
	 * werden soll.
	 * 
	 * @return boolean
	 */
	public boolean getFaxCheck() {

		return faxCheck.isSelected();
	}

	/**
	 * Liefert Datum zurück welches genutzt werden soll
	 * 
	 * @return String
	 */
	public String date() {
		return dateField.getText();
	}

	/**
	 * Liefert Faxnummer zurück
	 * 
	 * @return String
	 */
	public String fax() {
		return faxField.getText();
	}

	/**
	 * Zeigt eine Nachricht das alle geforderten Dokumente erstellt wurden sind.
	 */
	public void showMsg() {
		JOptionPane.showMessageDialog(hauptfenster,
				"Alle Schreiben wurden erstellt", "Bekanntgabeschreiben",
				JOptionPane.INFORMATION_MESSAGE);
	}

	/**
	 * Liefert eine Fehlermeldung das die ausgewählte XML-Datei fehlerhaft ist.
	 */
	public void showError() {
		JOptionPane.showMessageDialog(hauptfenster, "XML-Datei Fehlerhaft",
				"Fehler", JOptionPane.ERROR_MESSAGE);
	}

	public String getBeginnField() {
		return beginnField.getText();
	}

	public String getEndeField() {
		return endeField.getText();
	}

	public String getErreichbarField() {
		return erreichbarField.getText();
	}

	/**
	 * Liefert Funktion des Bearbeiters zurück
	 * 
	 * @return String
	 */
	public String getFunktionField() {
		return funktionField.getText();
	}
}
 
das Adden der Listener muss VOR setVisible(true) stehen, weil der Code eben genau dort anhält, bis der Dialog beendet ist,
etwas sauberer ist auch, mit setVisible(true) nicht den Konstruktor ewig offen zu halten, könnte der Aufrufer durchführen
 
Einer von den beiden genutzen Listener

Java:
	public class OkListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			setVisible(false);

			dispose();
		}
	}

Ich denke, dein Fehler liegt da. Du musst dem Listener natürlich auch sagen, das dispose() sich auf den Dialog bezieht, also z.B. eine Referenz des Dialogs mit übergeben. Und das setVisible(false) ist m.E. nicht nötig.
 
Zuletzt bearbeitet von einem Moderator:

Zurück
Oben