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

    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
    Rep Power


    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, 06:28 AM
  2. Fill a menu dynamically when menu is shown
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:47 PM
  3. How to use SWT menu and menu event
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:46 PM
  4. React to menu action and checkbox menu
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 08:50 PM
  5. Replies: 7
    Last Post: 05-09-2008, 08: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