1
JToolbars 부동 이미지를 전송 핸들러에서 드래그 이미지처럼 쉽게 변경할 수 있습니까? 자체 전송 핸들러를 코딩하지 않아도됩니까?JToolbars 부동 이미지를 변경하는 방법
JToolbars 부동 이미지를 전송 핸들러에서 드래그 이미지처럼 쉽게 변경할 수 있습니까? 자체 전송 핸들러를 코딩하지 않아도됩니까?JToolbars 부동 이미지를 변경하는 방법
분명히 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;
}