public void mouseClicked(MouseEvent e) { if (i < 6) { bx[i] = e.getX(); by[i] = e.getY(); br[i] = (int) (Math.random() * 50); i++; p.repaint(); } else if (i == 6) { i = 0; } }
public void updateColor(Color c, Object source) { // record colour for the object rgb = c.getRGB(); if (source != red && source != green && source != blue) { red.setIntValue((rgb & 0xff0000) >> 16); green.setIntValue((rgb & 0xff00) >> 8); blue.setIntValue((rgb & 0xff)); hexText.setText("0x" + String.format("%06x", rgb & 0xffffff)); } colorSample.setBackground(c); colorSample.repaint(); }