Results 1 to 6 of 6

Thread: Class JRadioButtonMenuItem

  1. #1
    Join Date
    Dec 2009
    Posts
    32

    Class JRadioButtonMenuItem

    Hi All,

    I am beginner in the field of java programming. Java comprises lots of new inbuilt classes as compare to the any other programming language. But classes are very tough to understand. I am getting trouble while understanding the 'RadioButtonMenuItem' class of the java language. I don't know anything about use of this java class. I have referred many java books, but nothing was helpful. If you posses the knowledge about 'RadioButtonMenuItem class', please let know the same. I am waiting for your reply

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Class JRadioButtonMenuItem

    A JRadioButtonMenuItem is a menu item that is part of a group of menu items in which only one item in the group can be selected. The selected item displays its selected state. Selecting it causes any other selected item to switch to the unselected state. To control the selected state of a group of radio button menu items, use a ButtonGroup object. Menu items can be configured, and to some degree controlled, by Actions. Using an Action with a menu item has many benefits beyond directly configuring a menu item.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Class JRadioButtonMenuItem

    Hello friend,

    Please review below example of JRadioButtonMenuItem class:
    Code:
    import javax.swing.JRadioButtonMenuItem;
    
    public class JRdButtonMenuItemDM {
      public static void main(String args[]) {
        JFrame fj = new JFrame("JRadioButtonMenuItem Sample");
        fj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JMenuBar bar1 = new JMenuBar();
        JMenu menu1 = new JMenu("Options");
        menu1.setMnemonic(KeyEvent.VK_O);
        ButtonGroup group1 = new ButtonGroup();
        JRadioButtonMenuItem menuItem1 = new JRadioButtonMenuItem("A");
        group1.add(menuItem);
        menu1.add(menuItem);
        menuItem1 = new JRadioButtonMenuItem("B");
        group1.add(menuItem);
        menu1.add(menuItem);
        menuItem1 = new JRadioButtonMenuItem("C");
        group1.add(menuItem);
        menu1.add(menuItem);
        bar1.add(menu);
        fj.setJMenuBar(bar);
        fj.setSize(400, 200);
        fj.setVisible(true);
      }
    }

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Class JRadioButtonMenuItem

    Hi,

    If you want to know the constructors of 'JRadioButtonMenuItem' class then please refer following constructors:
    1. JRadioButtonMenuItem(String txt, Icon icn, boolean bln)
    2. JRadioButtonMenuItem(String txt, Icon icn)
    3. JRadioButtonMenuItem(String txt, boolean bln)
    4. JRadioButtonMenuItem(String txt)
    5. JRadioButtonMenuItem(Icon icn, boolean bln)

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    Re: Class JRadioButtonMenuItem

    Hi friend,

    Following example of java will demonstrate you the implementation of the 'JRadioButtonMenuItem' class:
    Code:
    import javax.swing.JMenuItem;
    import javax.swing.JRadioButtonMenuItem;
    
    public class JMenuItemDemo {
      public static void main(final String args[]) {
    
        JFrame NW = new JFrame("MenuSample Example");
        NW.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JMenuBar MBL = new JMenuBar();
    
        JMenu FMK = new JMenu("File");
        FMK.setMnemonic(KeyEvent.VK_F);
        MBL.add(FMK);
       
        JMenu findOptionsMenu = new JMenu("Options");
        Icon atIcon = new ImageIcon("at.gif");
        findOptionsMenu.setIcon(atIcon);
        findOptionsMenu.setMnemonic(KeyEvent.VK_O);
        FMK.add(findOptionsMenu);
        
        NW.setJMenuBar(MBL);
        NW.setSize(300, 250);
        NW.setVisible(true);
      }
    }

  6. #6
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Class JRadioButtonMenuItem

    To know about the functionality of JRadioButtonMenuItem class, I suggest you study following nested classes of this java class:
    • JRadioButtonMenuItem.AccessibleJRadioButtonMenuItem
    • AbstractButton.ButtonChangeListener
    • Container.AccessibleAWTContainer
    • Component.BaselineResizeBehavior
    • AbstractButton.AccessibleAbstractButton

Similar Threads

  1. Replies: 8
    Last Post: 08-10-2011, 11:06 PM
  2. What is the difference between Local class and global class in C++?
    By Dëfrim in forum Software Development
    Replies: 4
    Last Post: 03-01-2011, 10:44 PM
  3. Replies: 5
    Last Post: 12-02-2010, 06:23 PM
  4. Ultra solid drives:Imation M-Class and S-Class
    By Regina in forum Portable Devices
    Replies: 1
    Last Post: 03-04-2009, 10:34 AM
  5. Good news for CBSE CLASS X & CLASS IX - visit learnnext
    By surya_expert in forum Education Career and Job Discussions
    Replies: 0
    Last Post: 13-12-2008, 12:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,719,154.93782 seconds with 16 queries