// Make sure we're using the Metal L&F, since the example needs it
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch (Exception e) {
System.err.println("Metal is not available on this platform?!");
e.printStackTrace();
System.exit(1);
}
JComponent before = makeExamplePane();
// Replace the MetalScrollBarUI with our own!
UIManager.put("ScrollBarUI", "MyMetalScrollBarUI");
JComponent after = makeExamplePane();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = f.getContentPane();
c.setLayout(new GridLayout(2, 1, 0, 1));
c.add(before);
c.add(after);
f.setSize(450, 400);
f.setVisible(true);