JButton sizePlus = view.getSizePlus(), sizeMinus = view.getSizeMinus(), magPlus = view.getMagPlus(), magMinus = view.getMagMinus(); sizePlus.addActionListener(this); sizePlus.setActionCommand(""+SIZE_PLUS); sizeMinus.addActionListener(this); sizeMinus.setActionCommand(""+SIZE_MINUS); magPlus.addActionListener(this); magPlus.setActionCommand(""+MAG_PLUS); magMinus.addActionListener(this); magMinus.setActionCommand(""+MAG_MINUS);
attachButtonListeners(view.getSizePlus(), SIZE_PLUS); attachButtonListeners(view.getSizeMinus(), SIZE_MINUS); attachButtonListeners(view.getMagPlus(), MAG_PLUS); attachButtonListeners(view.getMagMinus(), MAG_MINUS);
    void attachListeners()    {        //button        JButton sizePlus = view.getSizePlus(), sizeMinus = view.getSizeMinus(),                 magPlus = view.getMagPlus(), magMinus = view.getMagMinus();        sizePlus.addActionListener(this);        sizePlus.setActionCommand(""+SIZE_PLUS);        sizeMinus.addActionListener(this);        sizeMinus.setActionCommand(""+SIZE_MINUS);         magPlus.addActionListener(this);        magPlus.setActionCommand(""+MAG_PLUS);        magMinus.addActionListener(this);        magMinus.setActionCommand(""+MAG_MINUS);        //ComboBox        JComboBox box = view.getColors();        box.addActionListener(this);        box.setActionCommand(""+COLOR_SELECT);        //CheckBox        view.getOnOff().addItemListener(this);        view.getPin().addItemListener(this);        view.getPainting().addItemListener(this);    }