public void addBall(int priority, int tryb) { Ball b = new Ball(plansza, canvas, tryb, Integer.parseInt(field.getText())); canvas.set(b); BallThread thread = new BallThread(b); thread.setPriority(priority); thread.start(); }
@Override public void mousePressed(MouseEvent arg0) { Random r = new Random(); if (arg0.getButton() == 1) { if (arg0.getXOnScreen() + 30 < wymiar && arg0.getYOnScreen() < wymiar) plansza[arg0.getXOnScreen() - 30][arg0.getYOnScreen() - 60].color = new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)); } else { x = arg0.getXOnScreen() - 30; y = arg0.getYOnScreen() - 30; } canvas.repaint(); }