# Auf JFrame Panel adden



## Marco_adv (6. Dez 2006)

Guten Morgen,

mal wieder ein kleines Gui Problem:

ich schildere mal was ich machen möchte:

Ich habe eine Mainpage extends JFrame, diese hat nur eine Menübar mit Menüs, wenn ich nun einen Menu Punkt z.B Kalender aufrufe soll er den Kaelnder auf die leere ContentPane setzten Kalender ist ein Panel. Mit InternalFrame hab ich es schon probiert aber dann wird nur ein fenster rein gemacht dass ich ja verschieben kann und alles soll aber fest drauf sein hier der Code der beiden Klassen: falls ihn sich jemand antun will:


```
public class MainPage extends JFrame {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JMenuBar jJMenuBar = null;

	private JMenu dateiMenu = null;

	private JMenu schülerMenu = null;

	private JMenuItem verwaltenMenu = null;

	private JMenuItem suchenMenu = null;

	private JMenu gruppenMenu = null;

	private JMenuItem schuelerDMenu = null;

	private JMenuItem schuelerCMenu = null;

	private JMenuItem schuelerBMenu = null;

	private JMenuItem schuelerAMenu = null;

	private JMenuItem jugendMenu = null;

	private JMenuItem aktiveMenu = null;

	private JMenuItem oldiesMenu = null;

	private JMenu kalenderMenu = null;

	private JMenuItem öffnenKalenderMenu = null;

	private JMenu userMenu = null;

	private JMenuItem verwaltenUserMenu = null;

	private JMenu emailMenu = null;

	private JMenuItem formularMenu = null;

	private JMenu wettkampfMenu = null;

	private JMenuItem termineWettkampfMenu = null;

	private JMenuItem öffnenMenuItem = null;

	private JMenuItem speichernMenuItem = null;

	private JMenuItem schließenMenuItem = null;

	private JMenu startseiteMenu = null;

	/**
	 * This is the default constructor
	 */
	public MainPage() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 *
	 * @return void
	 */
	private void initialize() {
		this.setSize(1024, 768);
		this.setJMenuBar(getJJMenuBar());
		this.setContentPane(getJContentPane());
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setTitle("LA Tool der Spvgg Renningen");
	}

	/**
	 * This method initializes jContentPane
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
		}
		return jContentPane;
	}

	/**
	 * This method initializes jJMenuBar
	 *
	 * @return javax.swing.JMenuBar
	 */
	private JMenuBar getJJMenuBar() {
		if (jJMenuBar == null) {
			jJMenuBar = new JMenuBar();
			jJMenuBar.add(getDateiMenu());
			jJMenuBar.add(getStartseiteMenu());
			jJMenuBar.add(getSchülerMenu());
			jJMenuBar.add(getGruppenMenu());
			jJMenuBar.add(getKalenderMenu());
			jJMenuBar.add(getUserMenu());
			jJMenuBar.add(getEmailMenu());
			jJMenuBar.add(getWettkampfMenu());
		}
		return jJMenuBar;
	}

	/**
	 * This method initializes dateiMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getDateiMenu() {
		if (dateiMenu == null) {
			dateiMenu = new JMenu();
			dateiMenu.setText("Datei");
			dateiMenu.add(getÖffnenMenuItem());
			dateiMenu.add(getSpeichernMenuItem());
			dateiMenu.add(getSchließenMenuItem());
		}
		return dateiMenu;
	}

	/**
	 * This method initializes schülerMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getSchülerMenu() {
		if (schülerMenu == null) {
			schülerMenu = new JMenu();
			schülerMenu.setText("Schüler");
			schülerMenu.add(getVerwaltenMenu());
			schülerMenu.add(getSuchenMenu());
		}
		return schülerMenu;
	}

	/**
	 * This method initializes verwaltenMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getVerwaltenMenu() {
		if (verwaltenMenu == null) {
			verwaltenMenu = new JMenuItem();
			verwaltenMenu.setText("verwalten");
			verwaltenMenu.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					[b]AthletVerwaltenUI verwalten = new AthletVerwaltenUI();
					getContentPane().add(verwalten);
					getContentPane().setVisible(true);
					verwalten.setVisible(true);[/b]
					System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
				}
			});
		}
		return verwaltenMenu;
	}

	/**
	 * This method initializes suchenMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getSuchenMenu() {
		if (suchenMenu == null) {
			suchenMenu = new JMenuItem();
			suchenMenu.setText("suchen");
		}
		return suchenMenu;
	}

	/**
	 * This method initializes gruppenMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getGruppenMenu() {
		if (gruppenMenu == null) {
			gruppenMenu = new JMenu();
			gruppenMenu.setText("Gruppen");
			gruppenMenu.add(getSchuelerDMenu());
			gruppenMenu.add(getSchuelerCMenu());
			gruppenMenu.add(getSchuelerBMenu());
			gruppenMenu.add(getSchuelerAMenu());
			gruppenMenu.add(getJugendMenu());
			gruppenMenu.add(getAktiveMenu());
			gruppenMenu.add(getOldiesMenu());
		}
		return gruppenMenu;
	}

	/**
	 * This method initializes schuelerDMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getSchuelerDMenu() {
		if (schuelerDMenu == null) {
			schuelerDMenu = new JMenuItem();
			schuelerDMenu.setText("Schüler D");
		}
		return schuelerDMenu;
	}

	/**
	 * This method initializes schuelerCMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getSchuelerCMenu() {
		if (schuelerCMenu == null) {
			schuelerCMenu = new JMenuItem();
			schuelerCMenu.setText("Schüler C");
		}
		return schuelerCMenu;
	}

	/**
	 * This method initializes schuelerBMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getSchuelerBMenu() {
		if (schuelerBMenu == null) {
			schuelerBMenu = new JMenuItem();
			schuelerBMenu.setText("Schüler B");
		}
		return schuelerBMenu;
	}

	/**
	 * This method initializes schuelerAMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getSchuelerAMenu() {
		if (schuelerAMenu == null) {
			schuelerAMenu = new JMenuItem();
			schuelerAMenu.setText("Schüler A");
		}
		return schuelerAMenu;
	}

	/**
	 * This method initializes jugendMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getJugendMenu() {
		if (jugendMenu == null) {
			jugendMenu = new JMenuItem();
			jugendMenu.setText("Jugend");
		}
		return jugendMenu;
	}

	/**
	 * This method initializes aktiveMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getAktiveMenu() {
		if (aktiveMenu == null) {
			aktiveMenu = new JMenuItem();
			aktiveMenu.setText("Aktive");
		}
		return aktiveMenu;
	}

	/**
	 * This method initializes oldiesMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getOldiesMenu() {
		if (oldiesMenu == null) {
			oldiesMenu = new JMenuItem();
			oldiesMenu.setText("Oldies");
		}
		return oldiesMenu;
	}

	/**
	 * This method initializes kalenderMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getKalenderMenu() {
		if (kalenderMenu == null) {
			kalenderMenu = new JMenu();
			kalenderMenu.setText("Kalender");
			kalenderMenu.add(getÖffnenKalenderMenu());
		}
		return kalenderMenu;
	}

	/**
	 * This method initializes öffnenKalenderMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getÖffnenKalenderMenu() {
		if (öffnenKalenderMenu == null) {
			öffnenKalenderMenu = new JMenuItem();
			öffnenKalenderMenu.setText("öffnen");
		}
		return öffnenKalenderMenu;
	}

	/**
	 * This method initializes userMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getUserMenu() {
		if (userMenu == null) {
			userMenu = new JMenu();
			userMenu.setText("User");
			userMenu.add(getVerwaltenUserMenu());
		}
		return userMenu;
	}

	/**
	 * This method initializes verwaltenUserMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getVerwaltenUserMenu() {
		if (verwaltenUserMenu == null) {
			verwaltenUserMenu = new JMenuItem();
			verwaltenUserMenu.setText("verwalten");
		}
		return verwaltenUserMenu;
	}

	/**
	 * This method initializes emailMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getEmailMenu() {
		if (emailMenu == null) {
			emailMenu = new JMenu();
			emailMenu.setText("Email");
			emailMenu.add(getFormularMenu());
		}
		return emailMenu;
	}

	/**
	 * This method initializes formularMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getFormularMenu() {
		if (formularMenu == null) {
			formularMenu = new JMenuItem();
			formularMenu.setText("Email Formular");
		}
		return formularMenu;
	}

	/**
	 * This method initializes wettkampfMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getWettkampfMenu() {
		if (wettkampfMenu == null) {
			wettkampfMenu = new JMenu();
			wettkampfMenu.setText("Wettkampf");
			wettkampfMenu.add(getTermineWettkampfMenu());
		}
		return wettkampfMenu;
	}

	/**
	 * This method initializes termineWettkampfMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenuItem getTermineWettkampfMenu() {
		if (termineWettkampfMenu == null) {
			termineWettkampfMenu = new JMenuItem();
			termineWettkampfMenu.setText("Termine");
		}
		return termineWettkampfMenu;
	}

	/**
	 * This method initializes öffnenMenuItem
	 *
	 * @return javax.swing.JMenuItem
	 */
	private JMenuItem getÖffnenMenuItem() {
		if (öffnenMenuItem == null) {
			öffnenMenuItem = new JMenuItem();
			öffnenMenuItem.setText("öffnen");
		}
		return öffnenMenuItem;
	}

	/**
	 * This method initializes speichernMenuItem
	 *
	 * @return javax.swing.JMenuItem
	 */
	private JMenuItem getSpeichernMenuItem() {
		if (speichernMenuItem == null) {
			speichernMenuItem = new JMenuItem();
			speichernMenuItem.setText("speichern");
		}
		return speichernMenuItem;
	}

	/**
	 * This method initializes schließenMenuItem
	 *
	 * @return javax.swing.JMenuItem
	 */
	private JMenuItem getSchließenMenuItem() {
		if (schließenMenuItem == null) {
			schließenMenuItem = new JMenuItem();
			schließenMenuItem.setText("schließen");
		}
		return schließenMenuItem;
	}

	/**
	 * This method initializes startseiteMenu
	 *
	 * @return javax.swing.JMenu
	 */
	private JMenu getStartseiteMenu() {
		if (startseiteMenu == null) {
			startseiteMenu = new JMenu();
			startseiteMenu.setText("Startseite");
		}
		return startseiteMenu;
	}

}
```





```
public class AthletVerwaltenUI extends JPanel {

	private static final long serialVersionUID = 1L;

	private JPanel centerPanel = null;

	private JPanel auswahlPanel = null;

	private JPanel eingabePanel = null;

	private JPanel labelPanel = null;

	private JPanel buttonPanel = null;

	private JLabel gruppeLabel = null;

	private JLabel nameLabel = null;

	private JTextField nameTextField = null;

	private JComboBox gruppenComboBox = null;

	private JLabel athletInGruppeLabel = null;

	private JScrollPane athletenScrollPane = null;

	private JList athletenList = null;

	private JLabel vornameLabel = null;

	private JLabel strasseLabel = null;

	private JLabel hNrLabel = null;

	private JLabel plzLabel = null;

	private JLabel ortLabel = null;

	private JLabel telLabel = null;

	private JLabel emailLabel = null;

	private JLabel jahrgangLabel = null;

	private JLabel geschlechtLabel = null;

	private JTextField vornameTextField = null;

	private JTextField strasseTextField = null;

	private JTextField hNrTextField = null;

	private JTextField plzTextField = null;

	private JTextField ortTextField = null;

	private JTextField telTextField = null;

	private JTextField emailTextField = null;

	private JTextField jahrgangTextField = null;

	private JComboBox jahrgangComboBox = null;

	private JButton neuButton = null;

	private JButton aendernButton = null;

	private JButton loeschenButton = null;

	/**
	 * This is the default constructor
	 */
	public AthletVerwaltenUI() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 *
	 * @return void
	 */
	private void initialize() {
		this.setSize(800, 600);
		this.setLayout(new BorderLayout());
		this.add(getCenterPanel(), BorderLayout.CENTER);
		this.add(getButtonPanel(), BorderLayout.SOUTH);
	}

	/**
	 * This method initializes centerPanel
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getCenterPanel() {
		if (centerPanel == null) {
			GridLayout gridLayout = new GridLayout();
			gridLayout.setRows(1);
			centerPanel = new JPanel();
			centerPanel.setLayout(gridLayout);
			centerPanel.add(getAuswahlPanel(), null);
			centerPanel.add(getLabelPanel(), null);
			centerPanel.add(getEingabePanel(), null);
		}
		return centerPanel;
	}

	/**
	 * This method initializes auswahlPanel
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getAuswahlPanel() {
		if (auswahlPanel == null) {
			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
			gridBagConstraints5.fill = GridBagConstraints.BOTH;
			gridBagConstraints5.weighty = 1.0;
			gridBagConstraints5.gridx = 0;
			gridBagConstraints5.gridy = 3;
			gridBagConstraints5.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints5.weightx = 1.0;
			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
			gridBagConstraints4.gridx = 0;
			gridBagConstraints4.fill = GridBagConstraints.NONE;
			gridBagConstraints4.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints4.gridy = 2;
			athletInGruppeLabel = new JLabel();
			athletInGruppeLabel.setText("Athleten aus Gruppe");
			athletInGruppeLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
			gridBagConstraints3.fill = GridBagConstraints.BOTH;
			gridBagConstraints3.gridx = 0;
			gridBagConstraints3.gridy = 1;
			gridBagConstraints3.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints3.weightx = 1.0;
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
			gridBagConstraints1.fill = GridBagConstraints.NONE;
			gridBagConstraints1.insets = new Insets(10, 0, 10, 0);
			gridBagConstraints1.anchor = GridBagConstraints.CENTER;
			gruppeLabel = new JLabel();
			gruppeLabel.setText("Gruppe:");
			gruppeLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			auswahlPanel = new JPanel();
			auswahlPanel.setLayout(new GridBagLayout());
			auswahlPanel.add(gruppeLabel, gridBagConstraints1);
			auswahlPanel.add(getGruppenComboBox(), gridBagConstraints3);
			auswahlPanel.add(athletInGruppeLabel, gridBagConstraints4);
			auswahlPanel.add(getAthletenScrollPane(), gridBagConstraints5);
		}
		return auswahlPanel;
	}

	/**
	 * This method initializes eingabePanel
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getEingabePanel() {
		if (eingabePanel == null) {
			GridBagConstraints gridBagConstraints121 = new GridBagConstraints();
			gridBagConstraints121.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints121.gridy = 9;
			gridBagConstraints121.weightx = 1.0;
			gridBagConstraints121.insets = new Insets(0, 10, 0, 10);
			gridBagConstraints121.gridx = 0;
			GridBagConstraints gridBagConstraints101 = new GridBagConstraints();
			gridBagConstraints101.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints101.gridx = 0;
			gridBagConstraints101.gridy = 8;
			gridBagConstraints101.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints101.ipady = 4;
			gridBagConstraints101.weightx = 1.0;
			GridBagConstraints gridBagConstraints91 = new GridBagConstraints();
			gridBagConstraints91.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints91.gridx = 0;
			gridBagConstraints91.gridy = 7;
			gridBagConstraints91.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints91.ipady = 4;
			gridBagConstraints91.weightx = 1.0;
			GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
			gridBagConstraints81.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints81.gridx = 0;
			gridBagConstraints81.gridy = 6;
			gridBagConstraints81.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints81.ipady = 4;
			gridBagConstraints81.weightx = 1.0;
			GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
			gridBagConstraints71.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints71.gridx = 0;
			gridBagConstraints71.gridy = 5;
			gridBagConstraints71.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints71.ipady = 4;
			gridBagConstraints71.weightx = 1.0;
			GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
			gridBagConstraints61.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints61.gridx = 0;
			gridBagConstraints61.gridy = 4;
			gridBagConstraints61.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints61.ipady = 4;
			gridBagConstraints61.weightx = 1.0;
			GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
			gridBagConstraints51.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints51.gridx = 0;
			gridBagConstraints51.gridy = 3;
			gridBagConstraints51.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints51.ipady = 4;
			gridBagConstraints51.weightx = 1.0;
			GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
			gridBagConstraints41.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints41.gridx = 0;
			gridBagConstraints41.gridy = 2;
			gridBagConstraints41.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints41.ipady = 4;
			gridBagConstraints41.weightx = 1.0;
			GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
			gridBagConstraints31.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints31.gridwidth = 1;
			gridBagConstraints31.gridx = 0;
			gridBagConstraints31.gridy = 1;
			gridBagConstraints31.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints31.ipady = 4;
			gridBagConstraints31.weightx = 1.0;
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints.insets = new Insets(0, 10, 10, 10);
			gridBagConstraints.ipady = 4;
			gridBagConstraints.weightx = 1.0;
			eingabePanel = new JPanel();
			eingabePanel.setLayout(new GridBagLayout());
			eingabePanel.add(getNameTextField(), gridBagConstraints);
			eingabePanel.add(getVornameTextField(), gridBagConstraints31);
			eingabePanel.add(getStrasseTextField(), gridBagConstraints41);
			eingabePanel.add(getHNrTextField(), gridBagConstraints51);
			eingabePanel.add(getPlzTextField(), gridBagConstraints61);
			eingabePanel.add(getOrtTextField(), gridBagConstraints71);
			eingabePanel.add(getTelTextField(), gridBagConstraints81);
			eingabePanel.add(getEmailTextField(), gridBagConstraints91);
			eingabePanel.add(getJahrgangTextField(), gridBagConstraints101);
			eingabePanel.add(getJahrgangComboBox(), gridBagConstraints121);
		}
		return eingabePanel;
	}

	/**
	 * This method initializes labelPanel
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getLabelPanel() {
		if (labelPanel == null) {
			GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
			gridBagConstraints14.gridx = 0;
			gridBagConstraints14.ipadx = 0;
			gridBagConstraints14.ipady = 4;
			gridBagConstraints14.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints14.anchor = GridBagConstraints.WEST;
			gridBagConstraints14.gridy = 9;
			geschlechtLabel = new JLabel();
			geschlechtLabel.setText("Geschlecht:");
			geschlechtLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
			gridBagConstraints13.gridx = 0;
			gridBagConstraints13.ipadx = 0;
			gridBagConstraints13.ipady = 4;
			gridBagConstraints13.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints13.anchor = GridBagConstraints.WEST;
			gridBagConstraints13.gridy = 8;
			jahrgangLabel = new JLabel();
			jahrgangLabel.setText("Jahrgang:");
			jahrgangLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
			gridBagConstraints12.gridx = 0;
			gridBagConstraints12.ipadx = 0;
			gridBagConstraints12.ipady = 4;
			gridBagConstraints12.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints12.anchor = GridBagConstraints.WEST;
			gridBagConstraints12.gridy = 7;
			emailLabel = new JLabel();
			emailLabel.setText("E-Mail:");
			emailLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
			gridBagConstraints11.gridx = 0;
			gridBagConstraints11.ipadx = 0;
			gridBagConstraints11.ipady = 4;
			gridBagConstraints11.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints11.anchor = GridBagConstraints.WEST;
			gridBagConstraints11.gridy = 6;
			telLabel = new JLabel();
			telLabel.setText("Telefonnummer:");
			telLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
			gridBagConstraints10.gridx = 0;
			gridBagConstraints10.ipadx = 0;
			gridBagConstraints10.ipady = 4;
			gridBagConstraints10.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints10.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints10.anchor = GridBagConstraints.WEST;
			gridBagConstraints10.gridy = 5;
			ortLabel = new JLabel();
			ortLabel.setText("Ort");
			ortLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
			gridBagConstraints9.gridx = 0;
			gridBagConstraints9.ipadx = 0;
			gridBagConstraints9.ipady = 4;
			gridBagConstraints9.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints9.anchor = GridBagConstraints.WEST;
			gridBagConstraints9.gridy = 4;
			plzLabel = new JLabel();
			plzLabel.setText("Postleizahl:");
			plzLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
			gridBagConstraints8.gridx = 0;
			gridBagConstraints8.ipadx = 0;
			gridBagConstraints8.ipady = 4;
			gridBagConstraints8.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints8.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints8.anchor = GridBagConstraints.WEST;
			gridBagConstraints8.gridy = 3;
			hNrLabel = new JLabel();
			hNrLabel.setText("Hausnummer:");
			hNrLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
			gridBagConstraints7.gridx = 0;
			gridBagConstraints7.ipadx = 0;
			gridBagConstraints7.ipady = 4;
			gridBagConstraints7.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints7.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints7.anchor = GridBagConstraints.WEST;
			gridBagConstraints7.gridy = 2;
			strasseLabel = new JLabel();
			strasseLabel.setText("Straße:");
			strasseLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
			gridBagConstraints6.gridx = 0;
			gridBagConstraints6.ipadx = 0;
			gridBagConstraints6.ipady = 4;
			gridBagConstraints6.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints6.anchor = GridBagConstraints.WEST;
			gridBagConstraints6.gridy = 1;
			vornameLabel = new JLabel();
			vornameLabel.setText("Vorname:");
			vornameLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
			gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints2.ipady = 4;
			gridBagConstraints2.insets = new Insets(0, 10, 10, 0);
			gridBagConstraints2.anchor = GridBagConstraints.WEST;
			gridBagConstraints2.ipadx = 0;
			nameLabel = new JLabel();
			nameLabel.setText("Name:");
			nameLabel.setFont(new Font("Dialog", Font.BOLD, 14));
			labelPanel = new JPanel();
			labelPanel.setLayout(new GridBagLayout());
			labelPanel.add(nameLabel, gridBagConstraints2);
			labelPanel.add(vornameLabel, gridBagConstraints6);
			labelPanel.add(strasseLabel, gridBagConstraints7);
			labelPanel.add(hNrLabel, gridBagConstraints8);
			labelPanel.add(plzLabel, gridBagConstraints9);
			labelPanel.add(ortLabel, gridBagConstraints10);
			labelPanel.add(telLabel, gridBagConstraints11);
			labelPanel.add(emailLabel, gridBagConstraints12);
			labelPanel.add(jahrgangLabel, gridBagConstraints13);
			labelPanel.add(geschlechtLabel, gridBagConstraints14);
		}
		return labelPanel;
	}

	/**
	 * This method initializes buttonPanel
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getButtonPanel() {
		if (buttonPanel == null) {
			GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
			gridBagConstraints17.anchor = GridBagConstraints.EAST;
			gridBagConstraints17.insets = new Insets(0, 10, 10, 10);
			GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
			gridBagConstraints16.anchor = GridBagConstraints.EAST;
			gridBagConstraints16.insets = new Insets(0, 10, 10, 10);
			GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
			gridBagConstraints15.anchor = GridBagConstraints.EAST;
			gridBagConstraints15.insets = new Insets(0, 300, 10, 10);
			buttonPanel = new JPanel();
			buttonPanel.setLayout(new GridBagLayout());
			buttonPanel.add(getNeuButton(), gridBagConstraints15);
			buttonPanel.add(getAendernButton(), gridBagConstraints16);
			buttonPanel.add(getLoeschenButton(), gridBagConstraints17);
		}
		return buttonPanel;
	}

	/**
	 * This method initializes nameTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getNameTextField() {
		if (nameTextField == null) {
			nameTextField = new JTextField();
		}
		return nameTextField;
	}

	/**
	 * This method initializes gruppenComboBox
	 *
	 * @return javax.swing.JComboBox
	 */
	private JComboBox getGruppenComboBox() {
		if (gruppenComboBox == null) {
			gruppenComboBox = new JComboBox();
		}
		return gruppenComboBox;
	}

	/**
	 * This method initializes athletenScrollPane
	 *
	 * @return javax.swing.JScrollPane
	 */
	private JScrollPane getAthletenScrollPane() {
		if (athletenScrollPane == null) {
			athletenScrollPane = new JScrollPane();
			athletenScrollPane.setViewportView(getAthletenList());
		}
		return athletenScrollPane;
	}

	/**
	 * This method initializes athletenList
	 *
	 * @return javax.swing.JList
	 */
	private JList getAthletenList() {
		if (athletenList == null) {
			athletenList = new JList();
		}
		return athletenList;
	}

	/**
	 * This method initializes vornameTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getVornameTextField() {
		if (vornameTextField == null) {
			vornameTextField = new JTextField();
		}
		return vornameTextField;
	}

	/**
	 * This method initializes strasseTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getStrasseTextField() {
		if (strasseTextField == null) {
			strasseTextField = new JTextField();
		}
		return strasseTextField;
	}

	/**
	 * This method initializes hNrTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getHNrTextField() {
		if (hNrTextField == null) {
			hNrTextField = new JTextField();
		}
		return hNrTextField;
	}

	/**
	 * This method initializes plzTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getPlzTextField() {
		if (plzTextField == null) {
			plzTextField = new JTextField();
		}
		return plzTextField;
	}

	/**
	 * This method initializes ortTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getOrtTextField() {
		if (ortTextField == null) {
			ortTextField = new JTextField();
		}
		return ortTextField;
	}

	/**
	 * This method initializes telTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getTelTextField() {
		if (telTextField == null) {
			telTextField = new JTextField();
		}
		return telTextField;
	}

	/**
	 * This method initializes emailTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getEmailTextField() {
		if (emailTextField == null) {
			emailTextField = new JTextField();
		}
		return emailTextField;
	}

	/**
	 * This method initializes jahrgangTextField
	 *
	 * @return javax.swing.JTextField
	 */
	private JTextField getJahrgangTextField() {
		if (jahrgangTextField == null) {
			jahrgangTextField = new JTextField();
		}
		return jahrgangTextField;
	}

	/**
	 * This method initializes jahrgangComboBox
	 *
	 * @return javax.swing.JComboBox
	 */
	private JComboBox getJahrgangComboBox() {
		if (jahrgangComboBox == null) {
			jahrgangComboBox = new JComboBox();
		}
		return jahrgangComboBox;
	}

	/**
	 * This method initializes neuButton
	 *
	 * @return javax.swing.JButton
	 */
	private JButton getNeuButton() {
		if (neuButton == null) {
			neuButton = new JButton();
			neuButton.setText("Athlet anlegen");
			neuButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					AthletenVerwalten verwalten = new AthletenVerwalten();
					String name = getNameTextField().getText();
					String vorname = getVornameTextField().getText();
					String strasse = getStrasseTextField().getText();
					int hausnr = Integer.parseInt(getHNrTextField().getText());
					int plz = Integer.parseInt(getPlzTextField().getText());
					String ort = getOrtTextField().getText();
					int telNr = Integer.parseInt(getTelTextField().getText());
					String email = getEmailTextField().getText();
					int jahrgang = Integer.parseInt(getJahrgangTextField()
							.getText());
					String geschlecht = (String) getJahrgangComboBox()
							.getSelectedItem();
					verwalten.athletenErstellen(name, vorname, strasse, hausnr,
							plz, ort, telNr, email, jahrgang, geschlecht);
				}
			});
		}
		return neuButton;
	}

	/**
	 * This method initializes aendernButton
	 *
	 * @return javax.swing.JButton
	 */
	private JButton getAendernButton() {
		if (aendernButton == null) {
			aendernButton = new JButton();
			aendernButton.setText("Athlet ändern");
		}
		return aendernButton;
	}

	/**
	 * This method initializes loeschenButton
	 *
	 * @return javax.swing.JButton
	 */
	private JButton getLoeschenButton() {
		if (loeschenButton == null) {
			loeschenButton = new JButton();
			loeschenButton.setText("Athlet löschen");
		}
		return loeschenButton;
	}

}
```


die wichtige stelle ist fett markiert


----------



## Gast (6. Dez 2006)

der wichtige teil auf den es ankommt ist also hier




```
private JMenuItem getVerwaltenMenu() {
      if (verwaltenMenu == null) {
         verwaltenMenu = new JMenuItem();
         verwaltenMenu.setText("verwalten");
         verwaltenMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
               [b]AthletVerwaltenUI verwalten = new AthletVerwaltenUI();
               getContentPane().add(verwalten);
               getContentPane().setVisible(true);
               verwalten.setVisible(true);[/b]
               System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
            }
         });
      }
      return verwaltenMenu;
   }
```


----------



## The_S (6. Dez 2006)

Wenn Kalender ein JPanel ist, dann mach einfach


```
mainpage.setContentPane(kalender)
```


----------



## Marco_adv (6. Dez 2006)

Jo funktioniert super, aber leider wird ist die größe falsch kann ich es  irgendwie packen damit es passt ich muss erst fenster maximieren und dann wieder kleiner machen, damit es passt

danke


----------



## The_S (6. Dez 2006)

du musst das Fenster neuzeichnen. Ein einfaches


```
validate();
```

sollte reichen.


----------



## Marco_adv (6. Dez 2006)

nee klappt leider nicht des liegt einfach zu hoch sieht so aus als würde er es erst unter die menubar schieben


----------



## The_S (6. Dez 2006)

evtl. noch ein repaint() !?


----------



## Marco_adv (6. Dez 2006)

Jo mit beidem gehts einwandfrei vielen dank


----------

