public AnimationPanel(GLEventListener renderer, AnimationTrigger trigger, Dimension dim) {
    super(new MigLayout("insets 0, nogrid, center, fill", "center", "center"));

    GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));

    _canvas = new GLCanvas(caps);
    _canvas.setName("glCanvas");
    _canvas.setMinimumSize(new Dimension(5, 5));
    setRenderer(renderer);

    if (trigger != null) {
      _defaultTrigger = null;
      _altTrigger = trigger;
      _altTrigger.setCanvas(_canvas);
    } else {
      _altTrigger = null;
      _defaultTrigger = new Animator(_canvas);
      _defaultTrigger.setPrintExceptions(true);
    }

    add(_canvas);
    setSize(dim);
  }
 /** Start processing animation events. */
 public synchronized void start() {
   if (_defaultTrigger != null) _defaultTrigger.start();
   else _altTrigger.start();
 }