DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  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.

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links