Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9025419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:16:04+00:00 2026-06-16T06:16:04+00:00

so i have this anchorpane where i wish to add a mouse listner for

  • 0

so i have this anchorpane where i wish to add a mouse listner for the Secondary mouse key ive tried the following but i keep getting an error anyone know what the problem is?

   mainDisplayPanel.addEventHandler(MouseButton.SECONDARY, new EventHandler<MouseButton>() {

                    @Override
                    public void handle(MouseButton event) {
                        System.out.Println("Works");

                    }
                });

for the record i have also tried this:

            mainDisplayPanel.addEventHandler(MouseButton.SECONDARY, new EventHandler<MouseEvent>() {

                @Override
                public void handle(MouseEvent event) {
                    System.out.println("WOrks");
                }
            });

Stack trace:

Bound mismatch: The generic method addEventHandler(EventType,
EventHandler) of type Node is not applicable for the
arguments (MouseButton, new EventHandler(){}). The
inferred type MouseButton&Event is not a valid substitute for the
bounded parameter

And the other:

Bound mismatch: The type MouseButton is not a valid substitute for the bounded parameter of the type EventHandler

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:16:06+00:00Added an answer on June 16, 2026 at 6:16 am

    There is no EventType based on MouseButton.SECONDARY. You need to check the MouseEvent itself:

    mainDisplayPanel.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
    
        @Override
        public void handle(MouseEvent event) {
            if (event.getButton() == MouseButton.SECONDARY) {
               System.out.println("Works");
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have this upload script, and it works. But I would like to add a
I have this function // add history paths and save data function AddPath( strTag,
I have this VM with tomcat, java, and grails in it. I've been getting
Have this dictionay retrieving values from DataTable: Dictionary<string,string> meta= ds.Tables[1].Select(key<>'format').AsEnumerable().ToDictionary(k=>k.Field<string>(0),v=>v.Field<string>(1)); How would I apply
I have this menu example But in this example new activity is not called,
Have this in a c# .net application: string key = e.KeyCode.ToString(); in .net 1.1
I have this regular expression that extracts meta tags from HTML documents but it
I have this menu http://jsbin.com/useqa4/3 The hover I think works correct, but what I
I have this query, which I know doesn't work, but I've left it as
Have this implementation file which compiles and runs fine, but gives me an unused

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.