Comment 7 for bug 1220575

Revision history for this message
RaiMan (raimund-hocke) wrote :

uups, now we worked in parallel ;-)

In my opinion the problem was, that the JSlider control does not have a PreferredSize before being packed into the layout, which only seems to be a problem in Linux

So I added the following in PatternSimilaritySlider::init()

 private void init() {
     showValue(lblVal, curVal);
            setPreferredSize(new Dimension(250, 54));
 }

In the layout part of PatternPaneScreenshot I simplified the layout this way

    GridBagConstraints c = new GridBagConstraints();

    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    pane.add(btnSimilar, c);
    pane.add(sldSimilar, c);

which makes this ugly stuff look a bit better.

So I would really appreciate, if you could test my version as well (not urgent though).

BTW: the update of the formula is correct. The problem is simply the width value returned at the beginning of paintComponent:
in your case it seems to be the sliders minimum size of 38 (left and right margin of 13 and the knob size of 12), which reveals, that the formula is wrong.
On Mac and Windows, I get a width of around 200, so the max calculated score is 187/174 = 1,07, which does not lead to the problem.

Many thanks for your efforts and contribution.