Java JMenu set accessible description
import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.SwingUtilities; public class Main { public Main() { JFrame jfrm = new JFrame("Menu Demo"); jfrm.setLayout(new FlowLayout()); jfrm.setSize(220, 200);//from w w w .j a v a 2s .co m jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar jmb = new JMenuBar(); // Create the File menu. JMenu jmFile = new JMenu("File"); jmFile.getAccessibleContext().setAccessibleDescription( "The only menu in this program that has menu items"); JMenuItem jmiOpen = new JMenuItem("Open"); JMenuItem jmiClose = new JMenuItem("Close"); JMenuItem jmiSave = new JMenuItem("Save"); JMenuItem jmiExit = new JMenuItem("Exit"); jmFile.add(jmiOpen); jmFile.add(jmiClose); jmFile.add(jmiSave); jmFile.addSeparator(); jmFile.add(jmiExit); jmb.add(jmFile); jfrm.setJMenuBar(jmb); jfrm.setVisible(true); } public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { public void run() { new Main(); } }); } }