JFormDesigner / FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)
https://www.formdev.com/flatlaf/
Apache License 2.0
3.46k stars 273 forks source link

Filechooser "Desktop" view shows incorrect details for user folder #249

Closed Bios-Marcel closed 3 years ago

Bios-Marcel commented 3 years ago

So, first, let me mention that this is not a flatlaf bug, since it's broken in the Windows L&F as well, but maybe it's possible to work around this issue, as I doubt that such a trivial swing bug will ever get fixed.

This happens when you switch to the details view and select "Desktop" in the combobox. So, for some weird reason the user folder is shown with an "element typ" that actually a date, but should be something like "Folder" or even empty.

Windows vs Flatlaf

DevCharly commented 3 years ago

Looks funny. Occurs also in Metal and Nimbus. And for "OneDrive" folder.

Bios-Marcel commented 3 years ago

It gets worse! Wait:

Bios-Marcel commented 3 years ago

Okay, this one is a bit more annoying. It looks like the filechooser somehow has overlapping columns or so. This happens in the detailed view when selecting your own user folder. It appears like column 1 and 2 are correct and starting from 3 they are shifted to the left. This is just a assumption though. This happens on Java 11, but not on Java 8. Both JREs come from https://github.com/ojdkbuild/ojdkbuild and I am running a x64 Windows 10.

Same thing though, seems to affect all look and feels. Again, I am sure flatlaf isn't the right place for this, but I hope we can do something anyways.

grafik

DevCharly commented 3 years ago

Strange, have this too...

Bios-Marcel commented 3 years ago

I guess I can try this out with java 15 tomorrow. Maybe it's already fixed 🤷

DevCharly commented 3 years ago

I have it in Java 15.

There are some strange characters in the date. You can see the when you add System.out.println(s); to FlatLabelUI.paintEnabledText().

BTW the column headers are also wrong. Date is in size (Größe) column. Path is in date (Änderungsdatum) column.

DevCharly commented 3 years ago

Regarding the strange dates in the last screenshot: There are left-to-right and right-to-left mark characters in the date:

<?01.?06.?2020 ??18:48>  200e 30 31 2e 200e 30 36 2e 200e 32 30 32 30 20 200f 200e 31 38 3a 34 38 

They come from native method sun.awt.shell.Win32ShellFolder2.doGetColumnValue(). Have not looked into the native code...

They are also visible in Windows L&F, but not in Nimbus or Metal.

Seems to depend on the used font. If using font "Dialog" in FlatLaf, they are not shown.

This can be reproduced in FlatLaf Demo: in menu use "Font > Dialog" to change font to Dialog, open file chooser with Ctrl+O, select current user (in combobox) and switch to "Details" (in toolbar).

Anyway, implemented a fix that removes those characters in commit 5b65ed87cdf6b587a2a8e38bc912d44e93f9749e

DevCharly commented 3 years ago

Regarding the initial issue, data displayed in wrong columns, this is a Java bug. The issue in first screenshot occurs even in Java 8. The issue in last screenshot occurs in Java 10+. Occurs also in other Lafs. Can't do much here.

Bios-Marcel commented 3 years ago

Fair enough. Thank you :)