public void mouseClicked(MouseEvent e) { if (cm != null) { if (cm.getMapSize() == 2 && e.getClickCount() == 1) { // invert color color = (color == 1) ? 0 : 1; chooser.setCurrentColor(color); mainWindow.setActiveEditorColor(color); if (chooser.isVisible()) { chooser.repaint(); } this.repaint(); } else if (e.getClickCount() % 2 == 0) { chooser.setVisible(true); } } }
public void setChoosedColor(int color) { this.color = color; mainWindow.setActiveEditorColor(color); repaint(); }