Ejemplo n.º 1
0
    @Override
    public void mousePressed(MouseEvent e) {
      super.mousePressed(e);
      if (!this.toolBar.isEnabled()) {
        return;
      }
      this.pressedToolbarHandler = false;
      Rectangle bumpRect = new Rectangle();

      if (this.toolBar.getOrientation() == SwingConstants.HORIZONTAL) {
        int x = RapidLookTools.isLeftToRight(this.toolBar) ? 0 : this.toolBar.getSize().width - 14;
        bumpRect.setBounds(x, 0, 14, this.toolBar.getSize().height);
      } else { // vertical
        bumpRect.setBounds(0, 0, this.toolBar.getSize().width, 14);
      }
      if (bumpRect.contains(e.getPoint())) {
        this.pressedToolbarHandler = true;
        Point dragOffset = e.getPoint();
        if (!RapidLookTools.isLeftToRight(this.toolBar)) {
          dragOffset.x -= (this.toolBar.getSize().width - this.toolBar.getPreferredSize().width);
        }
        setDragOffset(dragOffset);
      }
    }
Ejemplo n.º 2
0
 @Override
 public void mouseDragged(MouseEvent e) {
   if (this.pressedToolbarHandler) {
     super.mouseDragged(e);
   }
 }