public void actionPerformed(ActionEvent e) { if (e.getSource() == exitItem) { kbc.stopLoop(); setVisible(false); dispose(); } else if (e.getSource() == saveItem) { saveImage(); } else if (e.getSource() == sleepItem1) { setDelay(1); } else if (e.getSource() == sleepItem2) { setDelay(2); } else if (e.getSource() == sleepItem5) { setDelay(5); } else if (e.getSource() == sleepItem10) { setDelay(10); } else if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem jmi = (JCheckBoxMenuItem) e.getSource(); String stat = jmi.getText(); if (jmi.isSelected()) { kbc.addStatistic(stat); } else { kbc.removeStatistic(stat); } } }
private JComponent createToolPanel() { JComponent box = Box.createVerticalBox(); JCheckBox button = new JCheckBox(disablingItem.getText()); button.setModel(disablingItem.getModel()); box.add(Box.createGlue()); box.add(button); box.add(Box.createGlue()); JRadioButton blur = new JRadioButton(blurItem.getText()); blur.setModel(blurItem.getModel()); box.add(blur); JRadioButton emboss = new JRadioButton(embossItem.getText()); emboss.setModel(embossItem.getModel()); box.add(emboss); JRadioButton translucent = new JRadioButton(busyPainterItem.getText()); translucent.setModel(busyPainterItem.getModel()); box.add(translucent); box.add(Box.createGlue()); return box; }