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);
}
}

