fixed garbled stripe button drag image

This commit is contained in:
Egor.Ushakov
2016-08-11 21:22:01 +03:00
parent 038c683de8
commit 96dfde44c5
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -184,8 +184,14 @@ public final class StripeButton extends AnchoredButton implements ActionListener
myDragPane = findLayeredPane(e);
if (myDragPane == null) return;
final BufferedImage image = UIUtil.createImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
paint(image.getGraphics());
int width = getWidth() - 1; // -1 because StripeButtonUI.paint will not paint 1 pixel in case (anchor == ToolWindowAnchor.LEFT)
int height = getHeight() - 1; // -1 because StripeButtonUI.paint will not paint 1 pixel in case (anchor.isHorizontal())
BufferedImage image = UIUtil.createImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics graphics = image.getGraphics();
graphics.setColor(UIUtil.getBgFillColor(getParent()));
graphics.fillRect(0, 0, width, height);
paint(graphics);
graphics.dispose();
myDragButtonImage = new JLabel(new JBImageIcon(image)) {
public String toString() {