コード例 #1
0
 @Override
 public void addNotify() {
   super.addNotify();
   myGlassPane = IdeGlassPaneUtil.find(this);
   myDisposable = Disposer.newDisposable();
   myGlassPane.addMouseMotionPreprocessor(myListener, myDisposable);
   myGlassPane.addMousePreprocessor(myListener, myDisposable);
 }
コード例 #2
0
    protected void processMouseMotionEvent(MouseEvent e) {
      super.processMouseMotionEvent(e);

      if (!isShowing()) return;

      if (MouseEvent.MOUSE_DRAGGED == e.getID() && myWasPressedOnMe) {
        myDragging = true;
        setCursor(getResizeCursor());
        myGlassPane.setCursor(getResizeCursor(), myListener);

        myPoint = SwingUtilities.convertPoint(this, e.getPoint(), ThreeComponentsSplitter.this);
        if (getOrientation()) {
          if (getHeight() > 0 || myDividerZone > 0) {
            if (myIsFirst) {
              setFirstSize(Math.max(getMinSize(myFirstComponent), myPoint.y));
            } else {
              setLastSize(
                  Math.max(
                      getMinSize(myLastComponent),
                      ThreeComponentsSplitter.this.getHeight() - myPoint.y - getDividerWidth()));
            }
          }
        } else {
          if (getWidth() > 0 || myDividerZone > 0) {
            if (myIsFirst) {
              setFirstSize(Math.max(getMinSize(myFirstComponent), myPoint.x));
            } else {
              setLastSize(
                  Math.max(
                      getMinSize(myLastComponent),
                      ThreeComponentsSplitter.this.getWidth() - myPoint.x - getDividerWidth()));
            }
          }
        }
        ThreeComponentsSplitter.this.doLayout();
      } else if (MouseEvent.MOUSE_MOVED == e.getID()) {
        if (myGlassPane != null) {
          if (isInside(e.getPoint())) {
            myGlassPane.setCursor(getResizeCursor(), myListener);
            e.consume();
          } else {
            myGlassPane.setCursor(null, myListener);
          }
        }
      }

      if (myWasPressedOnMe) {
        e.consume();
      }
    }
コード例 #3
0
 @Override
 public void addNotify() {
   super.addNotify();
   if (!ScreenUtil.isStandardAddRemoveNotify(this)) return;
   myGlassPane = IdeGlassPaneUtil.find(this);
   if (myGlassPane != null) {
     myGlassPane.addMouseMotionPreprocessor(this, myDisposable);
   }
 }
コード例 #4
0
 protected void processMouseEvent(MouseEvent e) {
   super.processMouseEvent(e);
   if (!isShowing()) {
     return;
   }
   switch (e.getID()) {
     case MouseEvent.MOUSE_ENTERED:
       setCursor(getResizeCursor());
       break;
     case MouseEvent.MOUSE_EXITED:
       if (!myDragging) {
         setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
       }
       break;
     case MouseEvent.MOUSE_PRESSED:
       if (isInside(e.getPoint())) {
         myWasPressedOnMe = true;
         myGlassPane.setCursor(getResizeCursor(), myListener);
         e.consume();
       } else {
         myWasPressedOnMe = false;
       }
       break;
     case MouseEvent.MOUSE_RELEASED:
       if (myWasPressedOnMe) {
         e.consume();
       }
       if (isInside(e.getPoint())) {
         myGlassPane.setCursor(getResizeCursor(), myListener);
       }
       myWasPressedOnMe = false;
       myDragging = false;
       myPoint = null;
       break;
     case MouseEvent.MOUSE_CLICKED:
       if (e.getClickCount() == 2) {
         center();
       }
       break;
   }
 }
コード例 #5
0
    private void _processMouseEvent(MouseEvent e) {
      MouseEvent event = getTargetEvent(e);
      if (event == null) {
        myGlassPane.setCursor(null, myListener);
        return;
      }

      processMouseEvent(event);
      if (event.isConsumed()) {
        e.consume();
      }
    }
コード例 #6
0
 private void init() {
   myGlassPane = IdeGlassPaneUtil.find(this);
   myGlassPane.addMouseMotionPreprocessor(myListener, this);
   myGlassPane.addMousePreprocessor(myListener, this);
 }