RFR: 8288882: JFileChooser - empty (0 bytes) file is displayed as 1 KB [v6]
Abhishek Kumar
duke at openjdk.org
Tue Jul 19 06:10:10 UTC 2022
On Tue, 19 Jul 2022 05:59:33 GMT, Abhishek Kumar <duke at openjdk.org> wrote:
>>> So ALL of these have an "off by one" issue don't they ?
>>>
>>> Here a file that is (for example) 2047 bytes in size will be displayed as "1KB"
>>
>> There is "off by one" issue in this case. One possible solution can be -
>>
>>
>> ![FileChooser_FileSizes](https://user-images.githubusercontent.com/107542245/179674833-345a7e81-4af2-403e-b9e1-9d690bffeddd.png)
>
> If any file having size >1024 byte & <2048 byte will be rounded off as 2 KB and so on.
> Similarly if file size is >1023KB will show file size as 1MB (rounding off will make file size as 1024KB and then it will convert it to MB).
![TestFileSize](https://user-images.githubusercontent.com/107542245/179677108-3ef9784e-fa28-464c-8b09-5a940dd0f57a.png)
File size shown by JFileChooser in details view.
-------------
PR: https://git.openjdk.org/jdk/pull/9327
More information about the client-libs-dev
mailing list