Insubstantial / insubstantial

Swing look-and-feel library and assorted widgets
193 stars 57 forks source link

SubstanceSliderUI incorrect calculation for labelRect.width #23

Closed kschaefe closed 12 years ago

kschaefe commented 13 years ago

SubstanceSliderUI line 862: if (this.slider.getOrientation() == JSlider.VERTICAL) {

Should be checking JSlider.HORIZONTAL, as the previous check was for VERTICAL. This causes UIs with large labels to have paiting problems as damaged JSlider's may not fully repaint.

shemnon commented 12 years ago

I'm going to need some more info on this. I tried to add som really long english words, but I guess 28 characters wasn't enough to get anything on the sliders page under test.Check. Do you have any better reproduction steps?

'gradle clean testCheckX'

kschaefe commented 12 years ago

My Dictionary contained JLabels with images. The images were not rendering correctly. They were approximately 150 pixels wide. It seems that on some cases the two paints happen and the result is a correctly painted slider, but sometimes only one paint occurs and the slider is partially painted because of the incorrect width.

shemnon commented 12 years ago

After some digging it looks like the offending code in calculateLabelRect is a remnant from pre 5.0 days when the label on vertical sliders was rendered vertically. Now they are always horizontal. Hence this code is removed wholesale.

Vertical sliders with horizontal labels is a better design decision anyway. The "T" layout is likely intentional where the slider is small (relative to text length) and the labels are long.

kschaefe commented 12 years ago

Thanks.