<Swing Dev> Editable combobox vs LaF change: javax.swing.plaf.UIResource vs javax.swing.plaf.basic.BasicComboBoxEditor.UIResource
Alexey Ivanov
alexey.ivanov at oracle.com
Fri Mar 20 17:50:30 UTC 2020
Hi Vladimir,
Thank you for your report, could you please submit the bug here:
https://bugs.java.com/bugdatabase
We would greatly appreciate if you could provide a test case.
Regards,
Alexey
On 20/03/2020 12:06, Vladimir Sitnikov wrote:
> Hi,
>
> I'm facing an issue that the editor for an editable combo box resets
> its border as LaF changes.
> It results in "textfield with border inside combobox" which looks weird.
>
> Here are the screenshots of how it looks:
> https://github.com/weisJ/darklaf/issues/104
>
> While I analyzing the issue, I found an interesting code in the OpenJDK.
>
> https://github.com/openjdk/jdk/blob/6dffcf753301385a5eeb869276967234126e509c/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java#L155
>
> static class BorderlessTextField extends JTextField {
> ...
> public void setBorder(Border b) {
> if (!(b instanceof UIResource)) {
> super.setBorder(b);
> }
> }
>
> Even though it looks OK, it is using **wrong** UIResource.
> I think the author was supposed to use javax.swing.plaf.UIResource,
> however, in practice the code is comparing the instance of
> javax.swing.plaf.basic.BasicComboBoxEditor.UIResource
> which is a simple class defined at the end of the file:
>
> public static class UIResource extends BasicComboBoxEditor
> implements javax.swing.plaf.UIResource {
> }
>
> I think BorderlessTextField#setBorder should be updated to read if
> (!(b instanceof javax.swing.plaf.UIResource)).
>
> Any thoughts on that?
>
> Vladimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20200320/294c34a7/attachment-0001.htm>
More information about the swing-dev
mailing list