private void doPopUp(MouseEvent e) { if (e.isPopupTrigger()) { this.button = (ColorIndexSupplier) e.getComponent(); int colorIndex = button.getColorCell(); for (int i = 0; i < groups.length; i++) { JMenuItem m = (JMenuItem) getSubElements()[Palette.split(colorIndex, i) + 64 * i]; m.setSelected(true); } show(e.getComponent(), e.getX(), e.getY()); } }
private void doSelect(ActionEvent e) { button.setColorCell( Palette.combine( IntStream.range(0, groups.length).map(i -> findSelected(groups[i])).toArray())); }