2014-08-29 2 views

답변

0

분명히 ToolbarUI의 paintDragWindow가 그 일을합니다.

내 도구 모음 이미지를 플로팅 img로 만드는이 코드를 사용했습니다.

@Override 
protected void paintDragWindow(Graphics g) { 
    BufferedImage img = getScreenShot(this.toolBar); 
    g.drawImage(img, 0, 0, null); 
    g.setColor(dragWindow.getBorderColor()); 

    g.drawRect(0, 0, toolBar.getWidth() - 1, toolBar.getHeight() - 1); 
    System.out.println("paint drag window"); 
} 

public static BufferedImage getScreenShot(Component component) { 

    BufferedImage image = new BufferedImage(component.getWidth(), 
      component.getHeight(), BufferedImage.TYPE_INT_RGB); 
    // call the Component's paint method, using 
    // the Graphics object of the image. 
    component.paint(image.getGraphics()); // alternately use .printAll(..) 
    return image; 
} 
관련 문제