@Override public Pair<Image, Point> createDraggedImage(DnDAction action, Point dragOrigin) { final TreePath[] paths = getSelectionPaths(); if (paths == null) return null; final int count = paths.length; final JLabel label = new JLabel(String.format("%s item%s", count, count == 1 ? "" : "s")); label.setOpaque(true); label.setForeground(myTree.getForeground()); label.setBackground(myTree.getBackground()); label.setFont(myTree.getFont()); label.setSize(label.getPreferredSize()); final BufferedImage image = UIUtil.createImage(label.getWidth(), label.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = (Graphics2D) image.getGraphics(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f)); label.paint(g2); g2.dispose(); return new Pair<Image, Point>( image, new Point(-image.getWidth(null), -image.getHeight(null))); }
private Dimension computeWindowSize(Dimension size) { if (myAdComponent != null && myAdComponent.isShowing()) { size.height += myAdComponent.getPreferredSize().height + 1; } return size; }