Observer1

Main.java

import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
import java.util.*;



@SuppressWarnings("serial")
public class Mainframe  extends JFrame  implements ActionListener, IUpdate {
	private JTextField editor = new JTextField();
	
	
	JMenuItem mnNew  = new JMenuItem("Neues Fenster");
	JMenuItem mnUpdate = new JMenuItem("Update");
	
	public Mainframe() {
		setLocation(100,10);
		setSize(300,100);
		setTitle("Beispiel Obeserver");
		setGUI();
	    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
	    
	    modell.addView(this);
	    editor.setText( modell.getText() );
		setVisible(true);
	}
	
	private void setGUI() {
		setLayout(new BorderLayout());
		setMenues();
		
		add(editor, BorderLayout.NORTH);
		editor.setFont(new Font("Arial", Font.BOLD, 18));
		
		
		editor.addActionListener(
				new java.awt.event.ActionListener() {
		           public void actionPerformed(ActionEvent e) {
		             edit_Change();
		          }
		        }
		);
		
	}
	
	private void setMenues() {
		JMenuBar menubar = new JMenuBar();
		JMenu mainFile = new JMenu("File");
		menubar.add(mainFile);
		mnNew.addActionListener(this);
		mainFile.add(mnNew);
		mnNew.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
	    
		mnUpdate.addActionListener(this);
		mainFile.add(mnUpdate);

		
		this.setJMenuBar(menubar);
		
		 for (int i = 0; i < menubar.getComponentCount(); i++) {
		      JMenu main = (JMenu) menubar.getComponent(i);
		      main.setFont(new Font("Arial", Font.BOLD, 18));
		      for (int j = 0; j < main.getItemCount(); j++) {
		        Component c = main.getItem(j);
		        if (c instanceof JMenuItem) {
		          JMenuItem mn = (JMenuItem) c;
		          mn.setFont(new Font("Arial", Font.BOLD, 18));
		        }
		      }
		    }		
	}
	
	
	private void edit_Change() {
		// hier fehlt Code
	}
	
	
	

	public static void main(String[] args) {
		new Mainframe();

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource()==mnNew) {
			new ClientWindow();
		}
		if (e.getSource()==mnUpdate) {
		  
		}
		
	}

}

ClientWindow.java

import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
import java.util.*;



@SuppressWarnings("serial")
public class Mainframe  extends JFrame  implements ActionListener, IUpdate {
	private JTextField editor = new JTextField();
	
	
	JMenuItem mnNew  = new JMenuItem("Neues Fenster");
	JMenuItem mnUpdate = new JMenuItem("Update");
	
	public Mainframe() {
		setLocation(100,10);
		setSize(300,100);
		setTitle("Beispiel Obeserver");
		setGUI();
	    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
	    
	    modell.addView(this);
	    editor.setText( modell.getText() );
		setVisible(true);
	}
	
	private void setGUI() {
		setLayout(new BorderLayout());
		setMenues();
		
		add(editor, BorderLayout.NORTH);
		editor.setFont(new Font("Arial", Font.BOLD, 18));
		
		
		editor.addActionListener(
				new java.awt.event.ActionListener() {
		           public void actionPerformed(ActionEvent e) {
		             edit_Change();
		          }
		        }
		);
		
	}
	
	private void setMenues() {
		JMenuBar menubar = new JMenuBar();
		JMenu mainFile = new JMenu("File");
		menubar.add(mainFile);
		mnNew.addActionListener(this);
		mainFile.add(mnNew);
		mnNew.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
	    
		mnUpdate.addActionListener(this);
		mainFile.add(mnUpdate);

		
		this.setJMenuBar(menubar);
		
		 for (int i = 0; i < menubar.getComponentCount(); i++) {
		      JMenu main = (JMenu) menubar.getComponent(i);
		      main.setFont(new Font("Arial", Font.BOLD, 18));
		      for (int j = 0; j < main.getItemCount(); j++) {
		        Component c = main.getItem(j);
		        if (c instanceof JMenuItem) {
		          JMenuItem mn = (JMenuItem) c;
		          mn.setFont(new Font("Arial", Font.BOLD, 18));
		        }
		      }
		    }		
	}
	
	
	private void edit_Change() {
		// hier fehlt Code
	}
	
	
	

	public static void main(String[] args) {
		new Mainframe();

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource()==mnNew) {
			new ClientWindow();
		}
		if (e.getSource()==mnUpdate) {
		  
		}
		
	}

}