/**
  * Adds the specified component to the container.
  *
  * @param c The component to add.
  */
 private void addComponent(JComponent c) {
   Container container = window.getContentPane();
   Component[] comps = container.getComponents();
   boolean in = false;
   for (int i = 0; i < comps.length; i++) {
     if (comps[i].equals(c)) {
       in = true;
       break;
     }
   }
   if (!in) {
     container.add(c, BorderLayout.CENTER);
     window.repaint();
   }
 }
 /**
  * Removes the specified component from the container.
  *
  * @param c The component to remove.
  */
 private void removeComponent(JComponent c) {
   window.getContentPane().remove(c);
 }
 /** Builds and lays out the UI. */
 private void buildUI() {
   Container container = window.getContentPane();
   container.add(titleBar, BorderLayout.NORTH);
   if (canvas != null) container.add(canvas, BorderLayout.CENTER);
 }