Browse Source

Fixed background painting issue.

pull/15/head
weisj 5 years ago
parent
commit
468bbfd6a6
  1. 7
      src/main/java/com/weis/darklaf/ui/combobox/DarkComboBoxUI.java
  2. 4
      src/main/java/com/weis/darklaf/ui/spinner/DarkSpinnerUI.java

7
src/main/java/com/weis/darklaf/ui/combobox/DarkComboBoxUI.java

@ -277,17 +277,16 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border {
if (comboBox.isEditable()) { if (comboBox.isEditable()) {
var arrowBounds = arrowButton.getBounds(); var arrowBounds = arrowButton.getBounds();
boolean leftToRight = comboBox.getComponentOrientation().isLeftToRight(); boolean leftToRight = comboBox.getComponentOrientation().isLeftToRight();
int off = leftToRight ? arrowBounds.x : arrowBounds.x + arrowBounds.width - 1; int off = leftToRight ? arrowBounds.x : arrowBounds.x + arrowBounds.width;
Area rect; Area rect;
Area iconRect; Area iconRect;
if (!isTableCellEditor && !isTreeCellEditor) { if (!isTableCellEditor && !isTreeCellEditor) {
rect = new Area(new RoundRectangle2D.Double(bSize, bSize, width - 2 * bSize, rect = new Area(new RoundRectangle2D.Double(bSize, bSize, width - 2 * bSize,
height - 2 * bSize, arc, arc)); height - 2 * bSize, arc, arc));
iconRect = new Area(new Rectangle(off, bSize, width - 2 * bSize - off + 1, iconRect = new Area(new Rectangle(off, 0, width, height));
height - 2 * bSize));
} else { } else {
rect = new Area(new Rectangle(0, 0, width, height)); rect = new Area(new Rectangle(0, 0, width, height));
iconRect = new Area(new Rectangle(off, 0, width - off + 1, height)); iconRect = new Area(new Rectangle(off, 0, width, height));
} }
if (leftToRight) { if (leftToRight) {
rect.intersect(iconRect); rect.intersect(iconRect);

4
src/main/java/com/weis/darklaf/ui/spinner/DarkSpinnerUI.java

@ -209,10 +209,10 @@ public class DarkSpinnerUI extends BasicSpinnerUI implements PropertyChangeListe
final int bSize, final int arc) { final int bSize, final int arc) {
var bounds = prevButton.getBounds(); var bounds = prevButton.getBounds();
boolean leftToRight = spinner.getComponentOrientation().isLeftToRight(); boolean leftToRight = spinner.getComponentOrientation().isLeftToRight();
int off = leftToRight ? bounds.x + 1 : bounds.x + bounds.width; int off = leftToRight ? bounds.x : bounds.x + bounds.width;
Area rect = new Area(new RoundRectangle2D.Double(bSize, bSize, width - 2 * bSize, height - 2 * bSize, Area rect = new Area(new RoundRectangle2D.Double(bSize, bSize, width - 2 * bSize, height - 2 * bSize,
arc, arc)); arc, arc));
Area iconRect = new Area(new Rectangle(off, bSize, width - 2 * bSize - off + 1, height - 2 * bSize)); Area iconRect = new Area(new Rectangle(off, 0, width, height));
if (leftToRight) { if (leftToRight) {
rect.intersect(iconRect); rect.intersect(iconRect);
} else { } else {

Loading…
Cancel
Save