private void mouseDraw(MouseEvent e) {
        int states = Goldfish.getMaxStates(rule);
        if (e.getX() < 0 || e.getY() < 0 || e.getX() / scale >= width || e.getY() / scale >= height)
            return;
        Patch p = _grid.getPatch(e.getX() / scale, e.getY() / scale);
        if (_drawState == -1) {
            if (p.getState() == 0) {
                if (SwingUtilities.isLeftMouseButton(e))
                    _drawState = states - 1;
                else if (SwingUtilities.isRightMouseButton(e))
                    _drawState = 1;
            } else {
                _drawState = 0;
            }
        }
        p.setState(_drawState);
        e.consume();
    }