import java.awt.*;import java.awt.event.*;class Test extends Frame implements InputMethodListener{ TextField tf = new TextField(); Button btn = new Button(); public Test(){ super("Fenster"); setSize(200,100); setLocation(200,200); setBackground(Color.lightGray); setLayout(null); tf.setBounds(10,30,80,20); tf.addInputMethodListener(this); btn.setBounds(10,60,80,20); btn.setLabel("Beenden"); add(tf); add(btn); btn.addActionListener(new CL_Beenden()); addWindowListener(new CL_WindowAdapter()); setVisible(true); } class CL_WindowAdapter extends WindowAdapter { public void windowClosing(WindowEvent evt) { System.exit(0); } } class CL_Beenden implements ActionListener { public void actionPerformed(ActionEvent evt) { System.exit(0); } } public void caretPositionChanged(InputMethodEvent event){ System.out.println("geht"); } public void inputMethodTextChanged(InputMethodEvent event){ System.out.println("geht auch"); } public static void main(String[]unbenutzt){ new Test(); }}