-
Bug
-
Resolution: Fixed
-
P4
-
1.1.7
-
merlin
-
x86
-
windows_nt
Name: dbT83986 Date: 04/25/99
Changung the UIDefaults property 'ScrollBar.width' does not affect.
The problem appears only on windows L&F.
Following is a code that demonstrates the problem exactly.
(you can copy-paste it to a file, compile and run it immediately):
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class ScrollBarDemo
{
public static void main(String[] str)
{
ScrollBarDemo s = new ScrollBarDemo();
}
public ScrollBarDemo()
{
// When commenting this try-catch clause, it works...
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception exc)
{
System.err.println("Error loading L&F: " + exc);
System.exit(0);
}
int sb_w = UIManager.getInt("ScrollBar.width");
System.out.println(sb_w); // prints '0' on Windows L&F
UIManager.put("ScrollBar.width", new Integer(32));
sb_w = UIManager.getInt("ScrollBar.width");
System.out.println(sb_w);
JFrame frame = new JFrame();
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
JPanel panel = new JPanel();
JPanel p1 = new JPanel(new BorderLayout());
JComboBox cb = new JComboBox(new String[] {"a","b","c","d","e","f"});
cb.setMaximumRowCount(5);
p1.add(cb, BorderLayout.NORTH);
JScrollPane sp = new JScrollPane(p1);
sp.setPreferredSize(new Dimension(200,200));
sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
panel.add(sp);
frame.setContentPane(panel);
frame.pack();
frame.setVisible(true);
}
}
(Review ID: 57305)
======================================================================