I'm taking my third class in Java. The last 3 weeks have been on GUI stuff (which I've never done before), and I can't figure this out.
//Create the menu bar.
JMenuBar myJMenuBar = new JMenuBar();
//Build the first menu.
JMenu fileMenu = new JMenu("File");
fileMenu.getAccessibleContext().setAccessibleDescription("The file menu.");
myJMenuBar.add(fileMenu);
... I insert more menu items here, which probably aren't important ...
frame.setJMenuBar(myJMenuBar);
When I run the program, I see my JFrame, but the JMenuBar object doesn't show up until I resize the window. Any idea on why it isn't showing it initially?
I am not confusing anything but using the metric most widely used to describe the "biggest" companies or who are "worth" the most. I agree in general tech companies are overvalued. Are you trying to make some argument Apple isn't doing well financially? LOL They certainly are NOT desperate by any measure and even if they were this wouldn't be a reason why. It's just good old marketing via social media which all companies do.
Question
struct
I'm taking my third class in Java. The last 3 weeks have been on GUI stuff (which I've never done before), and I can't figure this out.
//Create the menu bar. JMenuBar myJMenuBar = new JMenuBar(); //Build the first menu. JMenu fileMenu = new JMenu("File"); fileMenu.getAccessibleContext().setAccessibleDescription("The file menu."); myJMenuBar.add(fileMenu); ... I insert more menu items here, which probably aren't important ... frame.setJMenuBar(myJMenuBar);
When I run the program, I see my JFrame, but the JMenuBar object doesn't show up until I resize the window. Any idea on why it isn't showing it initially?
Link to comment
https://www.neowin.net/forum/topic/252542-java-jmenubar-not-appearing-until-window-resized/Share on other sites
8 answers to this question
Recommended Posts