2011-11-25 142 views

回答

2

BasicToolbarUI有floatAt方法。正如你可以從源代碼(下面)看到的工具欄使用工具欄的父容器的docing源。您可以嘗試覆蓋該方法並替換源代碼。

protected void floatAt(Point position, Point origin) 
    { 
    if(toolBar.isFloatable() == true) 
    { 
     try 
     { 
     Point offset = dragWindow.getOffset(); 
     if (offset == null) { 
     offset = position; 
     dragWindow.setOffset(offset); 
     } 
     Point global = new Point(origin.x+ position.x, 
        origin.y+position.y); 
     setFloatingLocation(global.x-offset.x, 
       global.y-offset.y); 
     if (dockingSource != null) { 
     Point dockingPosition = dockingSource.getLocationOnScreen(); 
     Point comparisonPoint = new Point(global.x-dockingPosition.x, 
          global.y-dockingPosition.y); 
     if (canDock(dockingSource, comparisonPoint)) { 
      setFloating(false, comparisonPoint); 
     } else { 
      setFloating(true, null); 
     } 
     } else { 
     setFloating(true, null); 
     } 
相關問題