8203281: [Windows] JComboBox change in ui when editor.setBorder() is called

Reviewed-by: psadhukhan
This commit is contained in:
Martin Mraz 2018-10-04 14:56:03 +05:30 committed by Prasanta Sadhukhan
parent 88a48fe2a6
commit 0f45d2d52a
2 changed files with 17 additions and 9 deletions

View File

@ -154,7 +154,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
comboBox.addMouseListener(rolloverListener);
arrowButton.addMouseListener(rolloverListener);
// set empty border as default to see vista animated border
comboBox.setBorder(new EmptyBorder(0,0,0,0));
comboBox.setBorder(new EmptyBorder(1,1,1,1));
}
}
@ -366,12 +366,20 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
if (XPStyle.getXP() != null && arrowButton != null) {
Dimension d = parent.getSize();
Insets insets = getInsets();
int buttonWidth = arrowButton.getPreferredSize().width;
arrowButton.setBounds(WindowsGraphicsUtils.isLeftToRight((JComboBox)parent)
? (d.width - insets.right - buttonWidth)
: insets.left,
insets.top,
buttonWidth, d.height - insets.top - insets.bottom);
int borderInsetsCorrection = 0;
if (((JComboBox)parent).getBorder() instanceof EmptyBorder) {
borderInsetsCorrection = 1;
}
arrowButton.setBounds(
WindowsGraphicsUtils.isLeftToRight((JComboBox)parent)
? (d.width - (insets.right - borderInsetsCorrection)
- arrowButton.getPreferredSize().width)
: insets.left - borderInsetsCorrection,
insets.top - borderInsetsCorrection,
arrowButton.getPreferredSize().width,
d.height - (insets.top - borderInsetsCorrection) -
(insets.bottom - borderInsetsCorrection));
}
}
};

View File

@ -672,8 +672,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
"ComboBox.buttonHighlight", ControlHighlightColor,
"ComboBox.selectionBackground", SelectionBackgroundColor,
"ComboBox.selectionForeground", SelectionTextColor,
"ComboBox.editorBorder", new XPValue(new EmptyBorder(1,4,1,1),
new EmptyBorder(1,4,1,4)),
"ComboBox.editorBorder", new XPValue(new EmptyBorder(1,3,1,1),
new EmptyBorder(1,3,1,4)),
"ComboBox.disabledBackground",
new XPColorValue(Part.CP_COMBOBOX, State.DISABLED,
Prop.FILLCOLOR, DisabledTextBackground),