import java.awt.*; import java.awt.event.*; public class CMergeButton extends Button implements ActionListener { private CPuzzleField m_PuzzleField; // Das Feld, das gemischt werden soll. private String m_ButtonLabel; // Die Beschriftung des Buttons public CMergeButton(String _Label, CPuzzleField _PField) { super(_Label); m_ButtonLabel= _Label; m_PuzzleField = _PField; addActionListener(this); } public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals(m_ButtonLabel)) { m_PuzzleField.merge(); m_PuzzleField.repaint(); } } }