JMenuItem not showing up.

JMenu menu;
JMenuBar menuBar = new JMenuBar();
JMenuItem menuItem;
menu = new JMenu("File");
menuBar.add(menu);
menuItem = menu.add(new JMenuItem("Exit"));
menuItem.addActionListener(new ExitActionListener());
setJMenuBar(menuBar);
When I click on "File", I don't see the "Exit" option at all. Any ideas? Thanks....

Don't know why. I took your code snipet and stuck it in one of my programs and it worked fine.
Just had to comment out the ActionListener bit.

Similar Messages

  • Disabled JMenuItem doesn show animated gif

    Hi there
    I would like to have a popup menu with actions that are enabled after they have finished with some background task taking some time. Basically this works fine for the enabling action on a shown popup. However, adding an animated gif as the icon or disabled icon does not show it in disabled state. In enabled state it works perfect. Please have a try with the sample code. You should see the disabled item for 2 secs and the icon is not showing up. After being enabled, it does. Invoking the menu again shows the animated gif in its last state left, but not moving any more.
    I guess, repaints are not done appropriately in disabled state... Any ideas how to solve that would be highly appreciated :-)
    Actually I used the icon at http://mentalized.net/activity-indicators/indicators/pascal_germroth/indicator.white.gif
    Cheers
    Daniel
    public class Main
      public static void main(String[] args)
        final JFrame frame = new JFrame();
        frame.addMouseListener(new MouseAdapter()
          public void mousePressed(final MouseEvent e)
            final JPopupMenu popup = new JPopupMenu();
            popup.add(new JMenuItem("Open..."));
            popup.add(new JMenuItem("Close"));
            final JMenuItem action = new JMenuItem("Long loading until enabled");
            action.setIcon(new ImageIcon("C:/spinner.gif"));
            action.setDisabledIcon(new ImageIcon("C:/spinner.gif"));
            popup.add(action).setEnabled(false);
            popup.show(e.getComponent(), e.getX(), e.getY());
            SwingUtilities.invokeLater(new Runnable()
              public void run()
                try
                  Thread.sleep(2000);
                  action.setEnabled(true);
                catch (InterruptedException e1)
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 200);
        frame.setVisible(true);
    }Edited by: daniel.frey on Apr 22, 2009 7:50 AM

    The problem is that you are causing the EDT to sleep, which means the GUI can't repaint itself. Read the section from the Swing tutorial on Concurrency to understand what is happening.

  • The JPanel did not show when the menu is selected

    My program consists a JMenu bar with sub menu items. When the user select on the menu items a panel with the gridbag layout will show with all the labels.but the panel did not show. Can anyone show the problem for me ?
    AdminFrameMain.java
    public class AdminFrameMain
         private DisplayMenuBar menubar;
         private DisplayToolBar toolbar;
         private DisplayStatusBar statusbar;     
         public AdminFrameMain()
              JFrame frame = new JFrame("S-League Administration Management System");
              Toolkit kit = frame.getToolkit();
              Dimension windowsize =kit.getScreenSize();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Container content = frame.getContentPane();
              content.setLayout(new BorderLayout());
              menubar = new DisplayMenuBar(frame,content);
              toolbar = new DisplayToolBar(content);
              statusbar = new DisplayStatusBar(content);
              frame.setSize(800,600);
              frame.setVisible(true);
         public static void main(String [] args){
              AdminFrameMain tm = new AdminFrameMain();
    DisplayMenuBar.java
    public class DisplayMenuBar
         private JMenu addMenu,addTeamMenu;
         private JMenuBar bar = new JMenuBar();
         private JToolBar toolbar = new JToolBar();
         private JMenuItem addTeamItem;
         private JFrame setFrame;
         private Container setContent;
         private AddTeamManagement addTeamMang;
         public DisplayMenuBar(JFrame frame,Container c)
              setFrame = frame;
              setContent = c;
              SetMenuBar();
         public void SetMenuBar()
         setFrame.setJMenuBar(bar);
         addMenu = new JMenu("Add");
         //file menu items list
         //Add sub menu
         addTeamMenu = new JMenu("Team Management");
         addMenu.add(addTeamMenu);
         //Add sub menu items
         addTeamMenu.add(addTeamItem = new JMenuItem("Add Team"));
         addTeamMenu.setMnemonic('T');     
         addTeamItem.setMnemonic('T');
         //team items listener
         //addTeamItem.addActionListener(taskcommand);          
         addTeamItem.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent e)
                   AddTeamManagement addTeamMang = new AddTeamManagement(setFrame,setContent);
         bar.add(addMenu);
    AddTeamManagement.java
    public class AddTeamManagement
         private JPanel addTeamPanel;
         private JFrame frame;
         private JButton createTeamBt,resetTeamBt;
         private Container addTeamContent;
         private JTextArea teamDescTextArea,teamIndpTextArea;
         private JTextField teamNameField;
         private JLabel teamID,teamDesc,teamInfo,numOfPlayers,teamZone,playersNum;
         private GridBagLayout gridBag;
         private GridBagConstraints constraints;
         public AddTeamManagement(JFrame f,Container c)
              System.out.println("add team mg");
              addTeamPanel = new JPanel();
              frame = f;
              addTeamContent = c;
              gridBag = new GridBagLayout();
              addTeamPanel.setLayout(gridBag);
              addTeamPanel.setBackground(Color.pink);
              constraints = new GridBagConstraints();
              teamID = new JLabel("Team ID:");
              teamDesc = new JLabel("Team Description:");
              teamInfo = new JLabel("Team Info:");
              numOfPlayers = new JLabel("No Of Players:");
              playersNum = new JLabel("15 Maximun");
              teamZone = new JLabel("Team Zone:");
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(teamID,0,0,1,1);
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(teamDesc,1,0,1,1);
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(teamInfo,2,0,1,1);
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(numOfPlayers,3,0,1,1);
              constraints.fill = constraints.VERTICAL;
              constraints.weightx = 1;
              constraints.weighty = 0;
              addComponent(teamZone,4,0,1,1);
              System.out.println("showing");
              addTeamContent.add(addTeamPanel,BorderLayout.CENTER);
         public void addComponent(Component component,int row,int column,int width,int height)
              System.out.println("adding c");
              constraints.gridx = column;
              constraints.gridy = row;
              constraints.gridwidth = width;
              constraints.gridheight = height;
              gridBag.setConstraints(component,constraints);
              addTeamPanel.add(component);
              addTeamPanel.setVisible(true);
    }

    Hello,
    you are missing only one link, just add following line to your actionPerformed method of DisplayMenuBar class and all problem will be solved
    setContent.validate();
    Actually, Swing component does not updated automatically. when you do any changes to the component layout it will set that component as invalidated component. To update the view you need to call validate() method defined in JComponent class.
    Virus

  • ITunes does not show up on apple tv 1st gen.

    i have a 1st gen apple tv with the 160 gig HD. recently, it will not show the itunes site. Under teh movies tab there are my movies and trailers and that's it. Does anyone know how to get the itunes store back on apple tv?

    Known issue currently, you'll need to wait for the fix.

  • My downloaded text sounds do not show up under the sounds tab in settings after installing 8.1.1. can someone help me please?

    i downloaded a couple text tones and since installing 8.1.1, they will not show up under the sounds tab. in fact, they do not show up in my recent purchases on itunes, but when i go to buy them again, it says that i have already bought this tone. I just want to use the tones i paid for as the tones on my phone. not asking much.... thanks for the help. i hope someone can help me get the tones working. thank you.

    This was happening to me too but only for some of my songs. I have a mac so I dunno about PCs, but for most of my ringtones I had to create an ACC version in itunes to make them short enough then turn that into a m4r and those all worked fine. But if the song was already short enough and I didn't create an ACC version and just turned the original into a m4r, then it wouldn't appear in my itunes.
    so if you're on a mac:
    1. go to get info, options, pick when you want the song to start and end.
         Has to be pretty short to work, 30 second or less is good
         if it's already short enough that's fine
    2. right click and click 'create ACC version'
         a copy with the length you put in will appear, drag that into a folder or whatever and just type in m4r where m4a would be
         still make an ACC version even if it's the right length
    Hopefully this helps someone else.

  • Internet Streams in Playlists do not show up on Apple TV

    I use the following setup:
    - Apple TV MD199LL/A (Software 6.0.1) just updated to the latest
    - iTunes 11.1.3 for Windows (from a Windows 7 x64)
    - iTunes 11.1.3 for MAC (from a Apple MacBook Pro x64, Maverix)
    Homesharing is turned on both computers
    From both machines I share pictures, videos and music.
    All photos, videos and music files are getting displayed  on the Apple TV menu, and can be played.
    All iTunes playlists from both machines are  getting displazed on the Apple TV
    BUT!
    If a internet stream is added to a playlist, this entry does not show on the Apple TV menu.
    If the playlist contains only internet streams the Apple TV menu says "There are no songs in this library"
    If I hit the play key on my remote, it  will randomly play the first stream in the playlist (not realy reproducable pattern)
    I can play those streams in iTunes and send it via AirPlay without problems,
    Can anyone help me with this and tell me what I'm doing wrong?
    Thank you

    You can only view that rental on the iPad. For it to show up it has to be rented directly on ATV or through a computer and streamed via home sharing

  • When I sync my iPod to my MacBook through iTunes new events do not show up and old events are not deleted. I am using Snow Leopard  and not iSync.

    I am using Snow Leopard on a MacBook. I have an iPod touch 3G. I do not use iSync it Mobile Me. When I sync my iPod through iTunes new events on my iPod do not show up on my Mac and old events do not delete. I have read help instructions that include deleting the data on the iPod. The iPod has the correct data and the Mac does not so I have not followed those instructions. I need help as the only reason I bought the Mac was to be able to sync, back up, view and print my calendar. Currently it is useless. If only Apple could have learned from the elegance of the Palm software.

    Start here:
    iPhone, iPad, or iPod touch: Device not recognized in iTunes for Windows

  • Synced videos do not show up on iPod

    Every time I sync my iPod with iTunes, although iTunes says the videos are synced, they do not show up in the Video app on the iPod.
    This is a fairly new problem.  All these videos have been synced before and they all showed up just fine in the Video app, but as of late the iPod does not show them.  Searching for them yields no results.
    The videos are in a compatible format and do not have an extremely high definition.  Again, I do not think the problem is with the videos, because previously I was able to view them all just fine.
    I have at least 1G of memory left, 2G without syncing the videos.
    I have erased and re-synced them in iTunes, to no avail.  I can play the videos on the iPod from iTunes, but not on the actual iPod device.  I'm using windows iTunes, and it is up to date.  The iPod software is up to date.  I don't want to do a restore because I've already done that multiple times for multiple issues, but if that's what I have to do, I will. It's a pretty old iPod.  I'm syncing with a third-party Duracell cable, but I really don't think that's the problem.
    I'm not sure what it means, but in iTunes I have checked the option that reads, "Prefer standard definition videos".  Syncing with that option unchecked changes nothing so far as I can tell.
    Thanks for all your help!
    iPod Touch 4th Gen. 8G
    iOS 6.1.6
    1G free with videos, 2G free without
    iTunes for Windows 64-bit V12.1
    Duracell 30 pin to USB iPod cable

    Try:
    - DFU mode and then restore to factory settings/new iPod via iTunes                   
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    - Try with a new video

  • Files do not show up on HDD

    I tried to get an answer through the iTunes community, and was advised to try here instead as it didn't have anything directly to do with iTunes
    Not all iTunes Files not showing up on External HDD
    So in a nutshell, all of my 35'000 iTunes files (actual MP3 files) were saved on a TC 2.0TB disk and used on multiple Mac's to pull music from. All music files would be saved and streamed wirelessly from this TC and nowhere else.
    I would always add files to this external wireless client and iTunes would work flawlessly playing whatever song I chose through the library.
    If I would go in to the iTunes directory (path) and look up files on the HDD the files were just not there (but if clicking on the link through iTunes - show in finder - they would appear on the HDD but only through this method). I gave it no further thought until my TC died (i.e. no longer powers up) on me...
    I removed the HDD from the TC and placed it in an USB cradle and after looking into the iTunes folder there are only a fraction of the folders / files much less than expected... When I do a cmd-I I'm told that there are 35'000 files, but they just won't show up.
    Any ideas on how i can get all the files to be displayed as I want to copy these over on a new TC and need to map iTunes to this new location/path?

    Hello Jfrosa,
    Thank you for the details of the issue you are experiencing with File Sharing.  I found an article that should help with troubleshooting this:
    OS X: How to connect to Windows File Sharing (SMB) using Snow Leopard or earlier
    http://support.apple.com/kb/ht1568
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Movie rentals that I downloaded onto iMac with Lion to do not show up on ATV 2 in menu for computers.  Purchased movies show up just fine.  What to do or look for?

    I have an imac that is running lion and an Apple TV generation 2.  I have rented a movie from itunes and it shows up on my imac in Itunes under a rental icon, and will play fine on my computer.  However, it does not show up as choice to play on my apple tv.  I have homesharing enabled and everything else works fine including purchased movies that are on my imac, but no where does it show rental movies. 
    What do I look for?  What do I do to play the rental movie on my apple tv 2?

    Answer to my own question:
    Wait until the downloaded rental has completed its download to the imac.  This took a long time for me, since it was part of several things that I was downloading at the same time.
    Finally, it showed up on my apple tv.   Interestingly, I was able to watch much of the movie on my iMac before the movie finished its download and was available to the ATV 2.

  • I have an apple iphone 4 that I want to download audio books from my library onto it.  I cannot figure out how to do that.  The iphone does not show up on my mac laptop as a connected device.  Does this kind of download have to run through itunes?  Thanks

    I have an apple iphone 4 that I want to download audio books from my library onto.  I cannot figure out how to do that.  The iphone does not show up on my mac laptop as a connected device.  Does this kind of download have to run through itunes?  Thanks

    Yes it is done through iTunes. The iPhone will never show up in Finder as a device. The following is general information on iTunes sync: http://support.apple.com/kb/HT1386 and the following is a previous discussion where the post by Andreas Junge helped others that had a problem syncing audiobooks: https://discussions.apple.com/message/20052732#20052732

  • HT1657 I rented a movie from iTunes but it is not showing up in the Movies section. What do I do?

    I just rented and downloaded a movie from iTunes and now it will not show up in my iTunes library. What do I do?
    It DOES show up in iTunes on my iPhone. It DOES NOT show up on my desktop.
    Any thoughts? Ideas?
    I rented it for a flight I get on in 3 hours. Any quick help would be great.
    Thanks.

    If the computer iTunes is signed into the same account then contact iTunes:
    How to report/refund an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase

  • HT5100 I have downloaded lectures from iTunes u but they do not show up on my bookshelf.  Why?

    I have downloaded lectures from iTunes u.  It had been working fine, but now my downloads do not show up on my bookshelf.  They do show up as downloaded when I search through the catalog.  How do I fix this?

    Wow, I just checked & all the DOWNLOADED songs MADE it into my iTunes "Songs". Thanks anyway!

  • CD's not purchased from iTunes but uploaded to iTunes do not show up in the music folder on Apple TV!  How can I fix this?

    CD's purchased from iTunes but uploaded to iTunes do not show up in the music folder on my Apple TV!  How do I fix this?

    You would need to make sure you're accessing the Computers icon. If you are under the Music icon, that will be accessing the cloud and only show iTunes purchases (unless you subscribe to iTunes Match)

  • HT204088 Why am I being charged for things that do not show up on my download histrory?

    I have a charge each week on my bank account from ITunes of things that I am not purchasing.  This week it is $1.29, and it does not show on my downloard history.  What is up with this?  And now I see where I hit the update button and all said FREE and now charged to update with one of my FREE apps. 

    You aren't charged to download app updates, though if you add or change the credit card details on your account then you might see a small temporary store holding charge, which should disappear within a few days.
    Have you made any in-app purchases or have any auto-renewing subscriptions ? If you don't recognise the charges then you can try contacting iTunes support and see if they see what they are for : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

Maybe you are looking for

  • HT1338 Dual Link DVI Adapter Doesn't Work

    I have a brand new MacBook Pro with Retina which replaced a 17" MacBook Pro. The 17" machine was connected via an Apple-branded Dual Link DVI adapter to a Dell 30" (2560 x 1600) external display - the best I can get the MacBook Pro/Retina to do is 16

  • Itunes does not pass windows logo testing to verify CD/DVDrom drives, Why?

    Hello All, When I try to install Itunes 9.2 on my XP 32bit machine, I get the error message "Itunes does not pass windows logo testing to verify CD/DVD rom drives this software will not be installed. Contact your administrator" I am the owner & my ac

  • Help iWeb Media browser doesn't see iPhoto

    New to iWeb and just upgraded to MacBook Pro. Have iPhoto all set up with my pictures but iWeb media browser does not show my library. I thought it would be automatic, but is there something I need to set up? I have looked and can't seem to find a fi

  • Multi-processor aware?

    I'm using Aperture 3 and CS5 on my 2GHz aluminum MacBook (4G RAM) and especially A3 seems to get bogged down at times. I'm considering a new 27" iMac. The question is does quad core or hyperthreading make a difference with A3 or CS5? I don't do video

  • Trying to Write Files in Java

    I've written this; it's one of three classes that work together in a java applet. import java.applet.*; import java.awt.*; import java.util.*;                            import java.io.*; class Game{Graphics run(Graphics bufferGraphics, ArrayList<Ima