Getting the state of a menu tick box


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Getting the state of a menu tick box

  1. #1
    Join Date
    Oct 2004
    Posts
    9

    Getting the state of a menu tick box

    Hi, I've created a menu tick box in my Java app. That was really easy and straight forward. Unfortunately I've had no luck in getting the state of the tick box menu (ticked or not).

    Any help would be much appreciated.

    Thanks.


    My tick box menu code.
    Code:
    // create the Connections menu
    JMenu connections = new JMenu("Connections");
    connections.setMnemonic(KeyEvent.VK_O);
    connections.add(new JCheckBoxMenuItem("Transmitter", true));
    connections.add(new JCheckBoxMenuItem("Reciever", true));

  2. #2
    Join Date
    Oct 2004
    Posts
    311

    Re: Getting the state of a menu tick box

    Originally posted by the-beast
    Hi, I've created a menu tick box in my Java app. That was really easy and straight forward. Unfortunately I've had no luck in getting the state of the tick box menu (ticked or not).

    Any help would be much appreciated.

    Thanks.


    My tick box menu code.
    Code:
    // create the Connections menu
    JMenu connections = new JMenu("Connections");
    connections.setMnemonic(KeyEvent.VK_O);
    connections.add(new JCheckBoxMenuItem("Transmitter", true));
    connections.add(new JCheckBoxMenuItem("Reciever", true));
    Create the menuChackboxes as global variables, and then add them to your menu.
    That way, you will have access to them from anywhere in your code.
    tHE WAY YOU DO IT NOW, YOU WON'T HAVE ANY REFERENCE TO THEM IN YOUR ACTUAL CODE.

  3. #3
    Join Date
    Oct 2004
    Posts
    9
    Turns out I forgot to add the thing to the ActionListner.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center