void processMousePressed(MouseEvent e) {

		super.processMousePressed(e);

		if (energizerButtonPressed)
			return;
		if (model.getJob() != null && !model.getJob().isStopped())
			return;

		int clickCount = e.getClickCount();
		if (clickCount >= 2) {
			if (actionID != HEAT_ID && actionID != COOL_ID && actionID != IRES_ID && actionID != DRES_ID && actionID != IDMP_ID && actionID != DDMP_ID && actionID != IPOL_ID && actionID != DPOL_ID && actionID != CPOS_ID && actionID != CNEG_ID) {
				resetUndoManager();
				setAction(SELE_ID);
			}
		}

		final int x = e.getX();
		final int y = e.getY();
		if (callOutMousePressed(x, y))
			return;
		if (handleMousePressed(x, y))
			return;

		switch (actionID) {

		case WHAT_ID:
			ModelComponent mc = getSelectedComponent(e.getModifiersEx(), x, y);
			String str = null;
			if (mc instanceof GayBerneParticle) {
				((GayBerneParticle) mc).setSelectedToResize(false);
				((GayBerneParticle) mc).setSelectedToRotate(false);
				str = mc.toString();
			} else if (mc instanceof ImageComponent) {
				str = "Image #" + getLayeredComponentIndex((ImageComponent) mc) + ":" + FileUtilities.getFileName(mc.toString());
			} else if (mc instanceof TextBoxComponent) {
				str = "Text box #" + getLayeredComponentIndex((TextBoxComponent) mc);
			} else if (mc instanceof LineComponent) {
				str = "Line #" + getLayeredComponentIndex((LineComponent) mc);
			} else if (mc instanceof RectangleComponent) {
				str = "Rectangle #" + getLayeredComponentIndex((RectangleComponent) mc);
			} else if (mc instanceof TriangleComponent) {
				str = "Triangle #" + getLayeredComponentIndex((TriangleComponent) mc);
			} else if (mc instanceof EllipseComponent) {
				str = "Ellipse #" + getLayeredComponentIndex((EllipseComponent) mc);
			}
			if (str != null) {
				str += " @ (" + ViewAttribute.ANGSTROM_FORMAT.format(x * 0.1) + ", " + ViewAttribute.ANGSTROM_FORMAT.format(y * 0.1) + ")";
			} else {
				str = "(" + ViewAttribute.ANGSTROM_FORMAT.format(x * 0.1) + ", " + ViewAttribute.ANGSTROM_FORMAT.format(y * 0.1) + ")";
			}
			showTip(str, x + 10, y + 10, -1);
			break;

		case SELE_ID:
			if (selectedComponent != null) {
				selectedComponent.setSelected(false);
				selectedComponent = null;
			}
			mc = getSelectedComponent(e.getModifiersEx(), x, y);
			if (mc != null) {
				mc.storeCurrentState();
				if (mc instanceof GayBerneParticle) {
					((GayBerneParticle) mc).setSelectedToRotate(false);
					((GayBerneParticle) mc).setSelectedToResize(false);
				}
				if (clickCount >= 2) {
					if (isPropertyDialogEnabled() || mc instanceof TextBoxComponent)
						DialogFactory.showDialog(mc);
				}
			}
			repaint();
			break;

		case RESI_ID:
			if (selectedComponent instanceof GayBerneParticle) {
				resizeHandle = ((GayBerneParticle) selectedComponent).getResizeHandle(x, y);
			}
			if (resizeHandle == -1) {
				mc = getSelectedComponent(e.getModifiersEx(), x, y);
				if (mc instanceof GayBerneParticle) {
					GayBerneParticle p = (GayBerneParticle) mc;
					p.setSelectedToResize(true);
					p.storeCurrentState();
				}
			} else {
				if (selectedComponent instanceof GayBerneParticle) {
					((GayBerneParticle) selectedComponent).storeCurrentState();
				}
			}
			break;

		case ROTA_ID:
			if (selectedComponent instanceof GayBerneParticle) {
				rotationHandle = ((GayBerneParticle) selectedComponent).getRotationHandle(x, y);
			}
			if (rotationHandle == -1) {
				mc = getSelectedComponent(e.getModifiersEx(), x, y);
				if (mc instanceof GayBerneParticle) {
					GayBerneParticle p = (GayBerneParticle) mc;
					p.setSelectedToRotate(true);
					p.storeCurrentState();
				}
			} else {
				if (selectedComponent instanceof GayBerneParticle) {
					((GayBerneParticle) selectedComponent).storeCurrentState();
				}
			}
			break;

		case HEAT_ID:
		case COOL_ID:
			pointHeater.setLocation(x, y);
			pointHeater.equiPartitionEnergy(model);
			repaint();
			break;

		case ADGB_ID:
			addGBIndicator.x = addGBIndicator.y = -1;
			if (clickCount == 1 && nParticle < gb.length - 1)
				insertAnGB(x, y, null);
			break;

		case COUN_ID:
			showActionTip("Drag the mouse to specify an area within which objects will be counted", x + 10, y + 10);
			if (clickCount == 1)
				selectedArea.setLocation(x, y);
			break;

		case MARK_ID:
			showActionTip("Drag the mouse to specify an area within which objects will be marked", x + 10, y + 10);
			if (clickCount == 1)
				selectedArea.setLocation(x, y);
			break;

		case LINE_ID:
			setSelectedComponent(null);
			break;

		case RECT_ID:
			setSelectedComponent(null);
			showActionTip("Drag the mouse to draw a rectangle", x + 10, y + 10);
			if (clickCount == 1)
				selectedArea.setLocation(x, y);
			break;

		case TRIA_ID:
			setSelectedComponent(null);
			showActionTip("Drag the mouse to draw a triangle", x + 10, y + 10);
			if (clickCount == 1)
				selectedArea.setLocation(x, y);
			break;

		case ELLI_ID:
			setSelectedComponent(null);
			showActionTip("Drag the mouse to draw an ellipse", x + 10, y + 10);
			if (clickCount == 1)
				selectedArea.setLocation(x, y);
			break;

		case DELE_ID:
			if (clickCount == 1)
				selectedArea.setLocation(x, y);
			break;

		case CPOS_ID:
			GayBerneParticle p = whichParticle(x, y);
			if (p != null) {
				p.setSelected(true);
				if (p.addCharge(e.isShiftDown() ? -chargeIncrement : chargeIncrement)) {
					repaint();
					model.notifyChange();
				}
			}
			break;

		case CNEG_ID:
			p = whichParticle(x, y);
			if (p != null) {
				p.setSelected(true);
				if (p.addCharge(e.isShiftDown() ? chargeIncrement : -chargeIncrement)) {
					repaint();
					model.notifyChange();
				}
			}
			break;

		case IPOL_ID:
			p = whichParticle(x, y);
			if (p != null) {
				p.setSelected(true);
				if (p.addDipoleMoment(e.isShiftDown() ? -dipoleIncrement : dipoleIncrement)) {
					repaint();
					model.notifyChange();
				}
			}
			break;

		case DPOL_ID:
			p = whichParticle(x, y);
			if (p != null) {
				p.setSelected(true);
				if (p.addDipoleMoment(e.isShiftDown() ? dipoleIncrement : -dipoleIncrement)) {
					repaint();
					model.notifyChange();
				}
			}
			break;

		case IRES_ID:
			p = whichParticle(x, y);
			if (p != null) {
				p.setSelected(true);
				if (p.getRestraint() == null) {
					p.setRestraint(new PointRestraint(10, p.getRx(), p.getRy()));
				} else {
					p.getRestraint().changeK(10);
				}
				repaint();
				model.notifyChange();
			}
			break;

		case DRES_ID:
			p = whichParticle(x, y);
			if (p != null && p.getRestraint() != null) {
				p.setSelected(true);
				if (p.getRestraint().getK() >= 10) {
					p.getRestraint().changeK(-10);
					if (p.getRestraint().getK() <= ZERO)
						p.setRestraint(null);
					repaint();
					model.notifyChange();
				}
			}
			break;

		case IDMP_ID:
			p = whichParticle(x, y);
			if (p != null) {
				p.setSelected(true);
				if (p.addFriction(0.5f)) {
					repaint();
					model.notifyChange();
				}
			}
			break;

		case DDMP_ID:
			p = whichParticle(x, y);
			if (p != null) {
				p.setSelected(true);
				if (p.addFriction(-0.5f)) {
					repaint();
					model.notifyChange();
				}
			}
			break;

		case VELO_ID:
			if (clickCount == 1) {
				if (!readyToAdjustVelocityVector) {
					p = (GayBerneParticle) getSelectedComponent(e.getModifiersEx(), x, y);
					if (p != null) {
						showActionTip("Drag the small red rectangle at the tip of the velocity vector", x + 10, y + 10);
						selectVelocity(p);
					}
				}
			}
			break;

		case OMEG_ID:
			if (clickCount == 1) {
				mc = getSelectedComponent(e.getModifiersEx(), x, y);
				if (mc instanceof GayBerneParticle) {
					p = (GayBerneParticle) mc;
					if (!readyToAdjustOmegaVector) {
						showActionTip("<html>Drag the red rectangle to change the magnitude,<br>click the center to reverse the direction</html>", x + 10, y + 10);
						selectOmega(p);
					}
					if (p.getFHotSpot().contains(x, y)) {
						p.setOmega(-p.getOmega());
						repaint();
					}
				}
			}
			break;

		case MEAS_ID:
			if (clickCount == 1) {
				if (!readyToAdjustDistanceVector) {
					Object o = getSelectedComponent(e.getModifiersEx(), x, y);
					if (o instanceof GayBerneParticle) {
						p = (GayBerneParticle) o;
						p.setSelected(true);
						if (e.isShiftDown()) {
							p.addMeasurement(new Point(2 * p.getRx() < getWidth() ? (int) (p.getRx() + 20) : (int) (p.getRx() - 20), (int) p.getRy()));
						} else {
							showActionTip(p.getNumberOfMeasurements() <= 0 ? "Hold down SHIFT and click to add a measurement." : "<html>Drag the green hotspot at the tip to measure, or<br>hold down SHIFT and click to add one more measurement.</html>", x + 10, y + 10);
						}
					}
				} else {
					showActionTip("<html>To remove this measurement, drag the<br>green hotspot out of this window.</html>", x + 10, y + 10);
				}
			}
			break;

		case TRAJ_ID:
			mc = getSelectedComponent(e.getModifiersEx(), x, y);
			if (mc instanceof GayBerneParticle) {
				p = (GayBerneParticle) mc;
				p.setSelected(true);
				p.setShowRTraj(!p.getShowRTraj());
				if (p.getShowRTraj()) {
					showActionTip("Click the particle to hide its trajectory", x + 20, y + 20);
				} else {
					showActionTip("Click the particle to show its trajectory", x + 20, y + 20);
				}
				repaint();
			}
			break;

		case RAVE_ID:
			mc = getSelectedComponent(e.getModifiersEx(), x, y);
			if (mc instanceof GayBerneParticle) {
				p = (GayBerneParticle) mc;
				p.setSelected(true);
				p.setShowRMean(!p.getShowRMean());
				if (p.getShowRMean()) {
					showActionTip("Click the particle to hide its current average position", x + 20, y + 20);
				} else {
					showActionTip("Click the particle to show its current average position", x + 20, y + 20);
				}
				repaint();
			}
			break;

		case DUPL_ID:
			mc = getSelectedComponent(e.getModifiersEx(), x, y);
			if (mc instanceof GayBerneParticle) {
				if (nParticle < gb.length) {
					showActionTip("Drag the selected Gay-Berne particle to duplicate one", x + 10, y + 10);
					gb[nParticle].duplicate((GayBerneParticle) mc, true);
					gb[nParticle].setSelected(true);
					nParticle++;
				}
			} else if (mc instanceof ImageComponent) {
				showActionTip("Drag the selected image to duplicate one", x + 10, y + 10);
				ImageComponent ic = null;
				try {
					ic = new ImageComponent((ImageComponent) mc);
				} catch (IOException ioe) {
					ioe.printStackTrace();
				}
				if (ic != null) {
					ic.setSelected(true);
					ic.setLocation(x - 10, y - 10);
					addLayeredComponent(ic);
				}
			} else if (mc instanceof TextBoxComponent) {
				showActionTip("Drag the selected text box to duplicate one", x + 10, y + 10);
				TextBoxComponent tb = new TextBoxComponent((TextBoxComponent) mc);
				tb.setSelected(true);
				tb.setLocation(x - 10, y - 10);
				addLayeredComponent(tb);
			} else if (mc instanceof LineComponent) {
				showActionTip("Drag the selected line to duplicate one", x + 10, y + 10);
				LineComponent lc = new LineComponent((LineComponent) mc);
				lc.setSelected(true);
				lc.setLocation(x - 10 - clickPoint.x, y - 10 - clickPoint.y);
				addLayeredComponent(lc);
			} else if (mc instanceof RectangleComponent) {
				showActionTip("Drag the selected rectangle to duplicate one", x + 10, y + 10);
				RectangleComponent rc = new RectangleComponent((RectangleComponent) mc);
				rc.setSelected(true);
				rc.setLocation(x - 10 - clickPoint.x, y - 10 - clickPoint.y);
				addLayeredComponent(rc);
			} else if (mc instanceof TriangleComponent) {
				showActionTip("Drag the selected triangle to duplicate one", x + 10, y + 10);
				TriangleComponent tc = new TriangleComponent((TriangleComponent) mc);
				tc.setSelected(true);
				tc.setLocation(x - 10 - clickPoint.x, y - 10 - clickPoint.y);
				addLayeredComponent(tc);
			} else if (mc instanceof EllipseComponent) {
				showActionTip("Drag the selected ellipse to duplicate one", x + 10, y + 10);
				EllipseComponent ec = new EllipseComponent((EllipseComponent) mc);
				ec.setSelected(true);
				ec.setLocation(x - 10 - clickPoint.x, y - 10 - clickPoint.y);
				addLayeredComponent(ec);
			}
			repaint();
			break;

		}

		e.consume();

	}