-
Bug
-
Resolution: Fixed
-
P4
-
8u60
-
b105
-
x86_64
-
windows_7
FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7
A DESCRIPTION OF THE PROBLEM :
When using a glue component to right align a toolbar component, the component does not appear. The issue occurs only with Synth based look and feels (i.e. Nimbus) and when a preferred size is set.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the posted test case - the third toolbar button does not appear.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The button with the label B:3 should appear at the right edge of the toolbar.
ACTUAL -
Button B:3 does not appear
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class RightButtonTest extends JFrame
{
public static void main(String[] args) throws Exception
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
new RightButtonTest();
}
});
}
public RightButtonTest()
{
JToolBar bar = new JToolBar();
bar.add(createButton(1));
bar.add(createButton(2));
bar.add(Box.createHorizontalGlue());
bar.add(createButton(3));
add(bar, BorderLayout.NORTH);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(600, 400);
setVisible(true);
}
private static JButton createButton(int id)
{
JButton b = new JButton("B: " + id);
b.setPreferredSize(new Dimension(60, b.getPreferredSize().height));
return b;
}
}
---------- END SOURCE ----------
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7
A DESCRIPTION OF THE PROBLEM :
When using a glue component to right align a toolbar component, the component does not appear. The issue occurs only with Synth based look and feels (i.e. Nimbus) and when a preferred size is set.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the posted test case - the third toolbar button does not appear.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The button with the label B:3 should appear at the right edge of the toolbar.
ACTUAL -
Button B:3 does not appear
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class RightButtonTest extends JFrame
{
public static void main(String[] args) throws Exception
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
new RightButtonTest();
}
});
}
public RightButtonTest()
{
JToolBar bar = new JToolBar();
bar.add(createButton(1));
bar.add(createButton(2));
bar.add(Box.createHorizontalGlue());
bar.add(createButton(3));
add(bar, BorderLayout.NORTH);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(600, 400);
setVisible(true);
}
private static JButton createButton(int id)
{
JButton b = new JButton("B: " + id);
b.setPreferredSize(new Dimension(60, b.getPreferredSize().height));
return b;
}
}
---------- END SOURCE ----------