swing: improved calculation of number of visible files