The Artima Developer Community
Sponsored Link

Java Answers Forum
help with MenuBar problem

1 reply on 1 page. Most recent reply: Jul 21, 2005 2:29 PM by Guido

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Guido

Posts: 38
Nickname: kiethb
Registered: May, 2002

help with MenuBar problem Posted: Jul 21, 2005 2:23 PM
Reply to this message Reply
Advertisement
Please tell me what I am doing wrong here. I am simply trying to emulate an existing program and using the setJMenuBar method however it is coming back errored as unrecognized. guarantee this is stupid but I just dont 'see' it! thanks
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
 
public class JMileage {
	
    private static void createAndShowGUI() {
        JFrame.setDefaultLookAndFeelDecorated(true);
	JFrame frame = new JFrame();
	frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
		JMenuBar menuBar = new JMenuBar();
    		setJMenuBar(menuBar);
		
        //Add Panel 
		JPanel topPanel = new JPanel();
		   frame.getContentPane().add(topPanel);
	//Display the window
		frame.setSize(500,400);
		frame.setVisible(true);
    }
 
    public static void main(String[] args) {
	        SwingUtilities.invokeLater(new Runnable() {
        	    public void run() {
                	createAndShowGUI();
            	    }
        	});
    }
}


Guido

Posts: 38
Nickname: kiethb
Registered: May, 2002

Re: help with MenuBar problem Posted: Jul 21, 2005 2:29 PM
Reply to this message Reply
Please disregard. I knew it was a silly issue. I needed to specify to which object I was setting the MenuBar on. Sorry to bother!

Flat View: This topic has 1 reply on 1 page
Topic: A problem in compiling Previous Topic   Next Topic Topic: Problem on seralisation

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use