* @param p
	 *            the type of particle to be inserted. If null, then use the parameters specified by <code>GayBerneConfigure</code>
	 * @return 'true' if the action is done, 'false' if not
	 */
	public boolean insertAnGB(int x, int y, GayBerneParticle p) {
		if (nParticle >= gb.length)
			return false;
		if (p == null) {
			if (GayBerneConfigure.length >= GayBerneConfigure.breadth) {
				gb[nParticle].setLength(GayBerneConfigure.length);
				gb[nParticle].setBreadth(GayBerneConfigure.breadth);
				gb[nParticle].setTheta(GayBerneConfigure.theta);
			} else {
				gb[nParticle].setLength(GayBerneConfigure.breadth);
				gb[nParticle].setBreadth(GayBerneConfigure.length);
				gb[nParticle].setTheta(Math.PI * 0.5 + GayBerneConfigure.theta);
			}
		} else {
			gb[nParticle].setLength(p.getLength());
			gb[nParticle].setBreadth(p.getBreadth());
			gb[nParticle].setTheta(p.getTheta());
		}
		gb[nParticle].setRx(x);
		gb[nParticle].setRy(y);
		if (finalizeGBInsertion()) {
			if (gb[nParticle].getLength() - gb[nParticle].getBreadth() < GayBerneConfigure.GB_LIMIT) {
				gb[nParticle].setLength(gb[nParticle].getBreadth() + GayBerneConfigure.GB_LIMIT);
			}
			gb[nParticle].setVx(0.0);
			gb[nParticle].setVy(0.0);
			gb[nParticle].setOmega(0.0);
			gb[nParticle].setRestraint(null);
			if (!model.getRecorderDisabled())
				gb[nParticle].initializeMovieQ(model.getMovie().getCapacity());
			if (p == null) {
				gb[nParticle].setColor(GayBerneConfigure.color);
				gb[nParticle].setEpsilon0(GayBerneConfigure.epsilon0);
				gb[nParticle].setEeVsEs(GayBerneConfigure.eeVsEs);
				gb[nParticle].setCharge(0);
				gb[nParticle].setCustom(0);
				gb[nParticle].setDipoleMoment(0.0);
				gb[nParticle].setInertia(0.5 * gb[nParticle].getMass() * gb[nParticle].getLength() * gb[nParticle].getBreadth());
			} else {
				gb[nParticle].setColor(p.getColor());
				gb[nParticle].setEpsilon0(p.getEpsilon0());
				gb[nParticle].setEeVsEs(p.getEeVsEs());
				gb[nParticle].setCharge(p.getCharge());
				gb[nParticle].setCustom(p.getCustom());
				gb[nParticle].setDipoleMoment(p.getDipoleMoment());
				gb[nParticle].setInertia(p.getInertia());
			}
			nParticle++;
			model.notifyChange();
			model.setNumberOfParticles(nParticle);
			if (!doNotFireUndoEvent) {
				gb[nParticle - 1].setSelected(true);
				model.getUndoManager().undoableEditHappened(new UndoableEditEvent(model, new UndoableInsertion(UndoAction.INSERT_A_PARTICLE, x, y)));
				updateUndoUIComponents();
			}
			repaint();
			return true;
		}
		return false;
	}