menuBar.getMenu(i).setSelected(false);
{ JMenu menu = menuBar.getMenu(i); if (menu != null) menu.setSelected(false); }
    public void mouseClicked(MouseEvent e)    {      MenuElement[] me = menuBar.getSubElements();            for (int i = 0; i < me.length; i++)        menuBar.getMenu(i).setSelected(false);    }