add JMenuBar to a JPanel?

You can use a BorderLayout for your JPanel and put the JMenuBar into the NORTH area of the panel with JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add(menubar, BorderLayout.NORTH); JMenuBar is a JComponent and can be added to a Container like any other JComponent.

How can I add a JTextField to a JFrame’s MenuBar?

I never see that as JMenuItem, I think that alyways placed in JMenuBar import java.awt.ComponentOrientation; import javax.swing.*; public class MenuGlueDemo { public MenuGlueDemo() { JMenuBar menuBar = new JMenuBar(); menuBar.add(createMenu(“Menu 1”)); menuBar.add(createMenu(“Menu 2”)); menuBar.add(createMenu(“Menu 3″)); menuBar.add(new JSeparator()); menuBar.add(new JButton(” Seach …. “)); menuBar.add(new JTextField(” Seach …. “)); menuBar.add(new JComboBox(new Object[]{“height”, “length”, “volume”})); menuBar.add(Box.createHorizontalGlue()); menuBar.add(createMenu(“About”)); JFrame … Read more

How do I move my JMenuBar to the screen menu bar on Mac OS X?

Depending on when it’s done, setting the property after your program launches may be too late to be effective. Instead, add the setting at launch time. java -Dapple.laf.useScreenMenuBar=true -jar MyApplication.jar Alternatively, set the property in your application bundle’s Info.plist, as discussed in Java Deployment Options for Mac OS X, Java Dictionary Info.plist Keys, About Info.plist … Read more