Browse Source

DnD: Pass component as ImageObserver, when calculating their size.

pull/245/head
weisj 3 years ago
parent
commit
e6644787b9
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneTransferHandler.java
  2. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameTransferHandler.java

4
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneTransferHandler.java

@ -165,8 +165,8 @@ public class TabbedPaneTransferHandler extends TransferHandler implements DropTa
Color color = ui != null ? ui.getDragBorderColor() Color color = ui != null ? ui.getDragBorderColor()
: tabbedPane.getBackgroundAt(currentTransferable.transferData.tabIndex); : tabbedPane.getBackgroundAt(currentTransferable.transferData.tabIndex);
Image tabImage = DnDUtil.createDragImage(tabbedPane, currentTransferable.transferData.tabBounds, 2, color); Image tabImage = DnDUtil.createDragImage(tabbedPane, currentTransferable.transferData.tabBounds, 2, color);
int w = tabImage.getWidth(null); int w = tabImage.getWidth(tabbedPane);
int h = tabImage.getHeight(null); int h = tabImage.getHeight(tabbedPane);
setDragImageOffset(new Point(w / 2, h / 2)); setDragImageOffset(new Point(w / 2, h / 2));
setDragImage(tabImage); setDragImage(tabImage);
} }

4
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameTransferHandler.java

@ -295,8 +295,8 @@ public class TabFrameTransferHandler extends TransferHandler implements DropTarg
protected void createDragImage(final TabFrameUI ui) { protected void createDragImage(final TabFrameUI ui) {
Component comp = currentTransferable.transferData.tab.getComponent(); Component comp = currentTransferable.transferData.tab.getComponent();
Image tabImage = DnDUtil.createDragImage(comp, 2, ui.getDragBorderColor()); Image tabImage = DnDUtil.createDragImage(comp, 2, ui.getDragBorderColor());
int w = tabImage.getWidth(null); int w = tabImage.getWidth(comp);
int h = tabImage.getHeight(null); int h = tabImage.getHeight(comp);
setDragImageOffset(new Point(w / 2, h / 2)); setDragImageOffset(new Point(w / 2, h / 2));
setDragImage(tabImage); setDragImage(tabImage);
} }

Loading…
Cancel
Save