Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
JCheckBox does not appear in JToolBar in Windows L&F under XP. Try the following on XP in 5.0u9 (or later) or 6.0 or 7.0: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TBCBTest extends JFrame { public TBCBTest() { super("TBCBTest"); JToolBar tb = new JToolBar(); tb.add(new JCheckBox("One")); tb.add(new JCheckBox("Two")); tb.add(new JCheckBox("Three")); add(tb, BorderLayout.NORTH); } private static void createAndShowGUI(String[] args) { TBCBTest test = new TBCBTest(); test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); test.pack(); test.setLocationRelativeTo(null); test.setVisible(true); } public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { } createAndShowGUI(args); } }); } } The problem goes away if you use the -Dswing.noxp flag.
|