Results 1 to 2 of 2
  1. #1
    Medabi3 is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default Need some help with a simple menu.

    Java Code:
    if (def.option1() != null) {
    menuOptions.add(new MenuOption("@whi@Examine", -1, -2));
    if (mouseClick == true){
    GameCanvas.addChatboxMessage("@whi@ A tree");
    }
    }
    I want to make a simple examine button in a game I'm making.
    So basicly what I want is when I click examine the message "It's a tree" must show up.

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    If you just want a button, I recommend a JButton instead of a menu. Create an ActionListener and add it to the button using 'addActionListener'. When teh button is pressed, the 'actionPerformed' method will be called and you can log your message from there.

Similar Threads

  1. Replies: 3
    Last Post: 08-07-2010, 05:28 AM
  2. Replies: 0
    Last Post: 07-07-2008, 04:47 PM
  3. How to use SWT menu and menu event
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-07-2008, 04:46 PM
  4. React to menu action and checkbox menu
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:50 PM
  5. Replies: 7
    Last Post: 05-09-2008, 07:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •