JRadioButton Windows look and feel JDK 5 or JDK 6. Not sized properly.

I have some code that worked on JDK 1.4.2 but now does not using JDK 5 or 6 when using the windows look and feel. The JRadioButtons are hardly visible and disappear if the window is resized. I don't really want to change my whole layout to fix this.

Thanks

import java.awt.BorderLayout;

import javax.swing.*;

publicclass Test1{

publicstaticvoid main(String a[]){

try{

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

}catch (Exception e1){

e1.printStackTrace();

}

JToolBar toolBar =new JToolBar();

toolBar.setLayout(new BoxLayout(toolBar, BoxLayout.X_AXIS));

toolBar.setFloatable(false);

toolBar.setBorderPainted(true);

toolBar.add(new JRadioButton("test"));

JMenu x =new JMenu("File");

JMenuBar menuBar =new JMenuBar();

JMenuItem o =new JMenuItem("Open");

x.add(o);

menuBar.add(x);

JPanel panel =new JPanel();

panel.setLayout(new BorderLayout());

panel.add("North", menuBar);

panel.add("Center", toolBar);

JFrame frame =new JFrame("Test");

frame.getContentPane().add(panel);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setSize(800, 300);

frame.setVisible(true);

}

}

[2358 byte] By [dmontia] at [2007-11-26 21:38:05]
# 1
Works fine for me
ignignokt84a at 2007-7-10 3:20:49 > top of Java-index,Desktop,Core GUI APIs...
# 2
I am running it Windows XP. I have tried on several machines with the same result. Make sure you are using the right JDK.Thanks
dmontia at 2007-7-10 3:20:49 > top of Java-index,Desktop,Core GUI APIs...
# 3
A workaround seems to be.toolBar.setUI(new MetalToolBarUI() );
dmontia at 2007-7-10 3:20:49 > top of Java-index,Desktop,Core GUI APIs...