예제 #1
0
  /**
   * Attaches this tooltip to a certain component
   *
   * @param component See above.
   * @param xOffset The x axis offset where the tooltip is to be shown
   * @param yOffset The y axis offset where the tooltiop is to be shown
   */
  public void attach(final JComponent component, final int xOffset, final int yOffset) {
    this.component = component;

    component.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            location = e.getPoint();
            location.translate(xOffset, yOffset);
            showTimer.restart();
            hideTimer.stop();
          }

          public void mouseExited(MouseEvent e) {
            showTimer.stop();
            hideTimer.restart();
          }
        });

    popupMenu.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            hideTimer.stop();
          }

          public void mouseExited(MouseEvent e) {
            Rectangle componentBounds =
                new Rectangle(
                    component.getLocationOnScreen(),
                    new Dimension(component.getWidth(), component.getHeight()));
            if (!componentBounds.contains(e.getLocationOnScreen())) {
              hideTimer.restart();
            }
          }
        });
  }
예제 #2
0
  // ¸ø´°ÌåÌî¼ÓÍ϶¯¹¦ÄÜ
  void setWindowDray(JComponent jc) {
    jc.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            isDragged = true;
            axis = new Point(e.getX(), e.getY());
            jif.setCursor(new Cursor(Cursor.MOVE_CURSOR));
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            isDragged = false;
            jif.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
          }
        });
    jc.addMouseMotionListener(
        new MouseMotionAdapter() {
          @Override
          public void mouseDragged(MouseEvent e) {
            if (isDragged) {
              mainLogin.setLocation(e.getXOnScreen() - axis.x, e.getYOnScreen() - axis.y);
            }
          }
        });
  }
예제 #3
0
 public ComponentTitledBorder(Component comp, JComponent container, Border border) {
   this.comp = comp;
   this.border = border;
   if (comp instanceof JComponent) {
     ((JComponent) comp).setOpaque(true);
   }
   container.addMouseListener(this);
   container.addMouseMotionListener(this);
 }
예제 #4
0
  @Override
  protected JComponent createChangePanel() {
    final JComponent primaryPanel = new JPanel(new BorderLayout());
    JComponent propertyPanel = new JPanel(new BorderLayout());
    JComponent nameAndRandomizePanel = new JPanel(new BorderLayout());
    JComponent propertySetterPanel = createPropertyPanel();
    JComponent centerPanel = createCenterPanel();
    if (canRandomize) {
      shouldRandomizeCheckBox = new JCheckBox();
      shouldRandomizeCheckBox.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              shouldRandomize = shouldRandomizeCheckBox.isSelected();
            }
          });
      nameAndRandomizePanel.add(shouldRandomizeCheckBox, BorderLayout.LINE_START);
      final MouseListener unrandomizer =
          new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
              if (e.getComponent().contains(e.getPoint())
                  && !shouldRandomizeCheckBox.contains(e.getPoint())) {
                shouldRandomizeCheckBox.setSelected(false);
                shouldRandomize = false;
              } else {
                System.out.println(e.getPoint() + "Is out of bounds");
              }
            }
          };
      ContainerListener mouseListenerAdder =
          new ContainerAdapter() {
            @Override
            public void componentAdded(ContainerEvent e) {
              addListeners(e.getChild());
            }

            public void addListeners(Component c) {
              c.addMouseListener(unrandomizer);
              if (c instanceof Container) {
                ((Container) c).addContainerListener(this);
                for (Component child : ((Container) c).getComponents()) {
                  addListeners(child);
                }
              }
            }
          };
      primaryPanel.addMouseListener(unrandomizer);
      primaryPanel.addContainerListener(mouseListenerAdder);
    }
    if (centerPanel != null) primaryPanel.add(centerPanel, BorderLayout.CENTER);
    nameAndRandomizePanel.add(new JLabel(name), BorderLayout.CENTER);
    propertyPanel.add(nameAndRandomizePanel, BorderLayout.LINE_START);
    propertyPanel.add(propertySetterPanel, BorderLayout.LINE_END);
    primaryPanel.add(propertyPanel, BorderLayout.PAGE_START);
    return primaryPanel;
  }
예제 #5
0
 /**
  * Attach popup menu on the given component.
  *
  * @param component component to which the popupMenu is attached
  * @param popupMenu popupMenu to be attached
  */
 public static void attachPopupMenu(final JComponent component, final JPopupMenu popupMenu) {
   component.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseReleased(MouseEvent e) {
           if (e.isPopupTrigger() && e.getComponent() instanceof JTable) {
             popupMenu.show(e.getComponent(), e.getX(), e.getY());
           }
         }
       });
 }
예제 #6
0
 private void draggable(JComponent virtualComp, JComponent realComp) {
   virtualComp.setTransferHandler(new ImageSelection(realComp));
   MouseListener listener =
       new MouseAdapter() {
         public void mousePressed(MouseEvent me) {
           JComponent comp = (JComponent) me.getSource();
           TransferHandler handler = comp.getTransferHandler();
           handler.exportAsDrag(comp, me, TransferHandler.COPY);
         }
       };
   virtualComp.addMouseListener(listener);
 }
 /**
  * Creates a component titled border with the specified component painted on top of the specified
  * border underneath.
  *
  * @param comp the component to be displayed
  * @param container the enclosed container
  * @param border the underlying border
  */
 public ComponentTitledBorder(JComponent comp, JComponent container, Border border) {
   this.comp = comp;
   this.comp.setOpaque(false);
   this.comp.setFont(UIManager.getFont("TitledBorder.font"));
   this.comp.setForeground(UIManager.getColor("TitledBorder.titleColor"));
   this.comp.setBorder(new EmptyBorder(0, 1, 0, 1));
   Dimension size = comp.getPreferredSize();
   this.rect = new Rectangle(offset, 1, size.width, size.height);
   this.container = container;
   this.border = border;
   this.intermediate = new JPanel();
   container.addMouseListener(this);
   container.addMouseMotionListener(this);
 }
  /**
   * Creates a new {@code SwingTerminalImplementation}
   *
   * @param component JComponent that is the Swing terminal surface
   * @param fontConfiguration Font configuration to use
   * @param initialTerminalSize Initial size of the terminal
   * @param deviceConfiguration Device configuration
   * @param colorConfiguration Color configuration
   * @param scrollController Controller to be used when inspecting scroll status
   */
  SwingTerminalImplementation(
      JComponent component,
      SwingTerminalFontConfiguration fontConfiguration,
      TerminalSize initialTerminalSize,
      TerminalEmulatorDeviceConfiguration deviceConfiguration,
      TerminalEmulatorColorConfiguration colorConfiguration,
      TerminalScrollController scrollController) {

    super(initialTerminalSize, deviceConfiguration, colorConfiguration, scrollController);
    this.component = component;
    this.fontConfiguration = fontConfiguration;

    // Prevent us from shrinking beyond one character
    component.setMinimumSize(
        new Dimension(fontConfiguration.getFontWidth(), fontConfiguration.getFontHeight()));

    //noinspection unchecked
    component.setFocusTraversalKeys(
        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.<AWTKeyStroke>emptySet());
    //noinspection unchecked
    component.setFocusTraversalKeys(
        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.<AWTKeyStroke>emptySet());

    // Make sure the component is double-buffered to prevent flickering
    component.setDoubleBuffered(true);

    component.addKeyListener(new TerminalInputListener());
    component.addMouseListener(
        new TerminalMouseListener() {
          @Override
          public void mouseClicked(MouseEvent e) {
            super.mouseClicked(e);
            SwingTerminalImplementation.this.component.requestFocusInWindow();
          }
        });
    component.addHierarchyListener(
        new HierarchyListener() {
          @Override
          public void hierarchyChanged(HierarchyEvent e) {
            if (e.getChangeFlags() == HierarchyEvent.DISPLAYABILITY_CHANGED) {
              if (e.getChanged().isDisplayable()) {
                onCreated();
              } else {
                onDestroyed();
              }
            }
          }
        });
  }
예제 #9
0
파일: Scene.java 프로젝트: kbarros/scikit
  public Scene(String title) {
    _canvas = createCanvas();
    _canvas.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            maybeShowPopup(e);
          }

          public void mouseReleased(MouseEvent e) {
            maybeShowPopup(e);
          }
        });
    _component = createComponent(_canvas);
    _component.setPreferredSize(new Dimension(OPTIMAL_FRAME_SIZE, OPTIMAL_FRAME_SIZE));
    _title = title;
  }
예제 #10
0
  public PanSettings() {
    initComponents();
    JComponent btnSave =
        ButtonUtil.addImageBackgroundButton(
            panContainer_btnSave, new DefaultButtonBuilder("default_150x50", "Save"));
    btnSave.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseClicked(MouseEvent evt) {
            super.mouseClicked(evt);
            saveSettings();
          }
        });
    loadSystemInformation();
    loadSettings();
  }
  public JComponent createComponent(final PagePanel pagepanel, PDFAnnotation annot) {
    final WidgetAnnotation widget = (WidgetAnnotation) annot;
    final DocumentPanel docpanel = pagepanel.getDocumentPanel();
    final FormSignature field = (FormSignature) widget.getField();
    final JComponent comp = createComponent(pagepanel, annot, null);

    comp.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent event) {
            if (!isWidgetReadOnly(widget, docpanel)) {
              SignatureProvider.selectSignProvider(
                  docpanel,
                  field,
                  comp,
                  event.getPoint(),
                  new ActionListener() {
                    public void actionPerformed(ActionEvent event) {
                      SignatureProvider ssp = (SignatureProvider) event.getSource();
                      try {
                        sign(field, docpanel, ssp);
                      } catch (Exception e) {
                        Util.displayThrowable(e, docpanel);
                      }
                    }
                  });
            }
          }
        });
    comp.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent event) {
            comp.repaint();
            docpanel.runAction(widget.getAction(Event.FOCUS));
          }

          public void focusLost(FocusEvent event) {
            if (comp.isValid()) {
              comp.repaint();
              docpanel.runAction(widget.getAction(Event.BLUR));
            }
          }
        });
    return comp;
  }
예제 #12
0
  /**
   * installs the components used for resizing (on left/right/bottom borders)
   *
   * @since 2.0.1
   */
  public void installResizers() { // 2005/10/06
    ResizeListener listener = new ResizeListener();
    left.addMouseMotionListener(listener);
    left.addMouseListener(listener);
    right.addMouseMotionListener(listener);
    right.addMouseListener(listener);
    bottom.addMouseMotionListener(listener);
    bottom.addMouseListener(listener);
    title.addMouseMotionListener(listener);
    title.addMouseListener(listener);
    getContentPane().add(left, BorderLayout.WEST);
    getContentPane().add(right, BorderLayout.EAST);
    getContentPane().add(bottom, BorderLayout.SOUTH);

    Color inactive = UIManager.getColor("inactiveCaption");
    left.setBackground(inactive);
    right.setBackground(inactive);
    bottom.setBackground(inactive);
  }
예제 #13
0
  /**
   * This Method registers a component at the TooltipManager, to be able to set the initialDelay of
   * the tooltip per componenent.
   *
   * @param c the component to register
   */
  public static void registerComponentAtTooltipManager(JComponent c) {
    InputMap imap = c.getInputMap();

    boolean removeKeyStroke = false;
    KeyStroke[] ks = imap.keys();
    if (ks == null || ks.length == 0) {
      imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, 0), "backSlash"); // dummy
      removeKeyStroke = true;
    }

    ToolTipManager.sharedInstance().registerComponent(c);
    //      ToolTipManager.sharedInstance().setDismissDelay(99000);     // set showing time to 99
    // seconds

    if (removeKeyStroke) {
      imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, 0));
    }

    c.addMouseListener(MOUSE_HANDLER);
  }
  public Java2DWindow(Core core, int width, int height) {
    this.core = core;
    this._frame = new JFrame();
    this._frame.setSize(width, height);
    this._frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this._rootcomp =
        new JComponent() {
          @Override
          protected void paintComponent(Graphics graphics) {
            Graphics2D gfx = (Graphics2D) graphics;
            _update(gfx, this);
          }
        };
    this._frame.add(_rootcomp);

    MasterListener ml = new MasterListener(_rootcomp, this);
    _rootcomp.addMouseListener(ml);
    _rootcomp.addMouseMotionListener(ml);
    _rootcomp.addKeyListener(ml);
  }
예제 #15
0
  /** {@inheritDoc} */
  @Override
  public void installUI(JComponent c) {
    super.installUI(c);
    c.setOpaque(true);
    c.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            if (isThumbRollover()) {
              thumbMousePressed = true;
              scrollbar.repaint();
            }
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            thumbMousePressed = false;
          }
        });
  }
예제 #16
0
 private static void addMouseListeners(JComponent control, List<MouseListener> mouseListeners) {
   for (int i = 0; i < mouseListeners.size(); i++) {
     MouseListener mouseListener = mouseListeners.get(i);
     control.addMouseListener(mouseListener);
   }
 }
 /** Installs <code>MouseListener</code> and a <code>MouseMotionListener</code>. */
 void installMouseListeners() {
   canvas.addMouseListener(this);
   canvas.addMouseMotionListener(this);
 }
예제 #18
0
  /** Sets up listeners */
  protected void setupListeners() {
    // Check to see if we need to close
    // the popup when a click outside of
    // it's area has been detected. Also,
    // we may need to propagte the events to
    // components below the glass pane
    glassPane.addMouseListener(
        new MouseListener() {
          /**
           * Invoked when the mouse button has been clicked (pressed and released) on a component.
           */
          public void mouseClicked(MouseEvent e) {
            propagateMouseListenerEvent(e);
          }

          /** Invoked when a mouse button has been pressed on a component. */
          public void mousePressed(MouseEvent e) {
            // Might need to hide the popup if the mouse
            // has been pressed on the glass pane
            handleHidePopup(e);

            propagateMouseListenerEvent(e);
          }

          /** Invoked when a mouse button has been released on a component. */
          public void mouseReleased(MouseEvent e) {
            propagateMouseListenerEvent(e);
          }

          /** Invoked when the mouse enters a component. */
          public void mouseEntered(MouseEvent e) {
            // Don't propagate here
            mouseOverGlassPane = true;
          }

          /** Invoked when the mouse exits a component. */
          public void mouseExited(MouseEvent e) {
            // Don't propagate
            mouseOverGlassPane = false;
          }

          /**
           * Checks to see if a mouse event on the glass pane should cause the popup to be hidden,
           * and if so, hides it.
           *
           * @param e The mouse event.
           */
          private void handleHidePopup(MouseEvent e) {
            if (HIDE_ON_CLICK == true) {
              hidePopup();
            }
          }
        });

    glassPane.addMouseMotionListener(
        new MouseMotionListener() {
          /**
           * Invoked when a mouse button is pressed on a component and then dragged. <code>
           * MOUSE_DRAGGED</code> events will continue to be delivered to the component where the
           * drag originated until the mouse button is released (regardless of whether the mouse
           * position is within the bounds of the component).
           *
           * <p>Due to platform-dependent Drag&Drop implementations, <code>MOUSE_DRAGGED</code>
           * events may not be delivered during a native Drag&Drop operation.
           */
          public void mouseDragged(MouseEvent e) {
            propagateMouseMotionListenerEvents(e);
          }

          /**
           * Invoked when the mouse cursor has been moved onto a component but no buttons have been
           * pushed.
           */
          public void mouseMoved(MouseEvent e) {
            propagateMouseMotionListenerEvents(e);
          }
        });
  }
  protected AbstractExpandableItemsHandler(@NotNull final ComponentType component) {
    myComponent = component;
    myComponent.add(myRendererPane);
    myComponent.validate();
    myPopup = new MovablePopup(myComponent, myTipComponent);

    myTipComponent.addMouseWheelListener(
        new MouseWheelListener() {
          @Override
          public void mouseWheelMoved(MouseWheelEvent e) {
            dispatchEvent(myComponent, e);
          }
        });

    myTipComponent.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseClicked(MouseEvent e) {
            dispatchEvent(myComponent, e);
          }

          @Override
          public void mousePressed(MouseEvent e) {
            dispatchEvent(myComponent, e);
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            dispatchEvent(myComponent, e);
          }

          @Override
          public void mouseEntered(MouseEvent e) {}

          @Override
          public void mouseExited(MouseEvent e) {
            // don't hide the hint if mouse exited to owner component
            if (myComponent.getMousePosition() == null) {
              hideHint();
            }
          }
        });

    myTipComponent.addMouseMotionListener(
        new MouseMotionListener() {
          @Override
          public void mouseMoved(MouseEvent e) {
            dispatchEvent(myComponent, e);
          }

          @Override
          public void mouseDragged(MouseEvent e) {
            dispatchEvent(myComponent, e);
          }
        });

    myComponent.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseEntered(MouseEvent e) {
            handleMouseEvent(e);
          }

          @Override
          public void mouseExited(MouseEvent e) {
            // don't hide the hint if mouse exited to it
            if (myTipComponent.getMousePosition() == null) {
              hideHint();
            }
          }

          @Override
          public void mouseClicked(MouseEvent e) {}

          @Override
          public void mousePressed(MouseEvent e) {
            handleMouseEvent(e);
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            handleMouseEvent(e);
          }
        });

    myComponent.addMouseMotionListener(
        new MouseMotionListener() {
          @Override
          public void mouseDragged(MouseEvent e) {
            handleMouseEvent(e);
          }

          @Override
          public void mouseMoved(MouseEvent e) {
            handleMouseEvent(e, false);
          }
        });

    myComponent.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            onFocusLost();
          }

          @Override
          public void focusGained(FocusEvent e) {
            updateCurrentSelection();
          }
        });

    myComponent.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentHidden(ComponentEvent e) {
            hideHint();
          }

          @Override
          public void componentMoved(ComponentEvent e) {
            updateCurrentSelection();
          }

          @Override
          public void componentResized(ComponentEvent e) {
            updateCurrentSelection();
          }
        });

    myComponent.addHierarchyBoundsListener(
        new HierarchyBoundsAdapter() {
          @Override
          public void ancestorMoved(HierarchyEvent e) {
            updateCurrentSelection();
          }

          @Override
          public void ancestorResized(HierarchyEvent e) {
            updateCurrentSelection();
          }
        });

    myComponent.addHierarchyListener(
        new HierarchyListener() {
          @Override
          public void hierarchyChanged(HierarchyEvent e) {
            hideHint();
          }
        });
  }
 public ComponentTitledBorder(Component comp, JComponent container, Border border) {
   this.comp = comp;
   this.container = container;
   this.border = border;
   container.addMouseListener(this);
 }
예제 #21
0
  ImageEditorUI(@Nullable ImageEditor editor) {
    this.editor = editor;

    Options options = OptionsManager.getInstance().getOptions();
    EditorOptions editorOptions = options.getEditorOptions();
    options.addPropertyChangeListener(optionsChangeListener);

    final PsiActionSupportFactory factory = PsiActionSupportFactory.getInstance();
    if (factory != null && editor != null) {
      copyPasteSupport =
          factory.createPsiBasedCopyPasteSupport(
              editor.getProject(),
              this,
              new PsiActionSupportFactory.PsiElementSelector() {
                public PsiElement[] getSelectedElements() {
                  PsiElement[] data = LangDataKeys.PSI_ELEMENT_ARRAY.getData(ImageEditorUI.this);
                  return data == null ? PsiElement.EMPTY_ARRAY : data;
                }
              });
    } else {
      copyPasteSupport = null;
    }

    deleteProvider = factory == null ? null : factory.createPsiBasedDeleteProvider();

    ImageDocument document = imageComponent.getDocument();
    document.addChangeListener(changeListener);

    // Set options
    TransparencyChessboardOptions chessboardOptions =
        editorOptions.getTransparencyChessboardOptions();
    GridOptions gridOptions = editorOptions.getGridOptions();
    imageComponent.setTransparencyChessboardCellSize(chessboardOptions.getCellSize());
    imageComponent.setTransparencyChessboardWhiteColor(chessboardOptions.getWhiteColor());
    imageComponent.setTransparencyChessboardBlankColor(chessboardOptions.getBlackColor());
    imageComponent.setGridLineZoomFactor(gridOptions.getLineZoomFactor());
    imageComponent.setGridLineSpan(gridOptions.getLineSpan());
    imageComponent.setGridLineColor(gridOptions.getLineColor());

    // Create layout
    ImageContainerPane view = new ImageContainerPane(imageComponent);
    view.addMouseListener(new EditorMouseAdapter());
    view.addMouseListener(new FocusRequester());

    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(view);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    // Zoom by wheel listener
    scrollPane.addMouseWheelListener(wheelAdapter);

    // Construct UI
    setLayout(new BorderLayout());

    ActionManager actionManager = ActionManager.getInstance();
    ActionGroup actionGroup =
        (ActionGroup) actionManager.getAction(ImageEditorActions.GROUP_TOOLBAR);
    ActionToolbar actionToolbar =
        actionManager.createActionToolbar(ImageEditorActions.ACTION_PLACE, actionGroup, true);

    // Make sure toolbar is 'ready' before it's added to component hierarchy
    // to prevent ActionToolbarImpl.updateActionsImpl(boolean, boolean) from increasing popup size
    // unnecessarily
    actionToolbar.updateActionsImmediately();

    actionToolbar.setTargetComponent(this);

    JComponent toolbarPanel = actionToolbar.getComponent();
    toolbarPanel.addMouseListener(new FocusRequester());

    JLabel errorLabel =
        new JLabel(
            ImagesBundle.message("error.broken.image.file.format"),
            Messages.getErrorIcon(),
            SwingConstants.CENTER);

    JPanel errorPanel = new JPanel(new BorderLayout());
    errorPanel.add(errorLabel, BorderLayout.CENTER);

    contentPanel = new JPanel(new CardLayout());
    contentPanel.add(scrollPane, IMAGE_PANEL);
    contentPanel.add(errorPanel, ERROR_PANEL);

    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.add(toolbarPanel, BorderLayout.WEST);
    infoLabel = new JLabel((String) null, SwingConstants.RIGHT);
    infoLabel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 0, 2));
    topPanel.add(infoLabel, BorderLayout.EAST);

    add(topPanel, BorderLayout.NORTH);
    add(contentPanel, BorderLayout.CENTER);

    updateInfo();
  }
예제 #22
0
 // PENDING: need to listen to orientation changes
 //
 public void installUI(JComponent comp) {
   this.scrollBar = (JScrollBar) comp;
   comp.addMouseListener(getMouseListener());
 }
예제 #23
0
 /**
  * Attaches the <code>controller</code> to the buttons of the titleBar.
  *
  * @param controller An instance of {@link DialogControl}.
  */
 public void attachMouseListener(MouseListener controller) {
   titleBar.addMouseListener(controller);
   if (canvas instanceof ThumbnailCanvas) canvas.addMouseListener(controller);
 }