On Wed, 10 Aug 2022 04:46:59 GMT, Abhishek Kumar <[email protected]> wrote:
> > > @prsadhuk I have made few changes in formatting the file size, using > > > MessageFormat and NumberFormat to format the file size with 1 decimal > > > place precision. Earlier JFileChooser show file size for "1.0" as "1", > > > now it will show one decimal place precision. Empty files show as "0 KB". > > > > > > If JFileChooser always shows a decimal point for nearly all files, should > > it show 0.0 KB for zero-sized files? > > I guess it would simplify your code as there'll be no reason to change > > number format. > > @aivanov-jdk It will simplify the code but I checked in native file system > and it shows "0 bytes" for zero-sized files. So to keep it similar to native, > zero-sized files shown as "0 KB". Yet still it's shows 0 KB in Java; all other sizes are showed with one digit after the decimal point, thus only 0 KB has special handling. It's different from the native system, and I am for consistency in Java approach. If we decided, we show the size as #.# where there's always a digit after the decimal point, I'd rather see it always displayed. It would be easier to scan the sizes. I wonder how the file size of 200 bytes is shown: 1 KB or 0.2 KB. ------------- PR: https://git.openjdk.org/jdk/pull/9327
