Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Mighty Mouse Handling in JavaFX Script: Examples by Sven

DZone's Guide to

Mighty Mouse Handling in JavaFX Script: Examples by Sven

· Java Zone
Free Resource

Bitbucket is for the code that takes us to Mars, decodes the human genome, or drives your next car. What will your code do? Get started with Bitbucket today, it's free.

A few days ago, I posted a mouse handling related question to the JavaFX GUI mailing list, and Sven Drieling responded with a link to some helpful examples that he created. One of these examples is a program that displays the information that can be retrieved from the MouseEvent object that is passed to the JavaFX mouse event handlers. Here's a screenshot of that application, named MouseEvents.fx:

 

Mouseeventssven

As shown in the JavaFX SDK Packages are Taking Shape post, the MouseEvent class is located in the new javafx.input package. Take a look at the Check out the JavaFX Script Documentation post to examine the MouseEvent class, as well as the mouse handler methods in the Node class which is located in the javafx.scene package.

Sven's second example demonstrates the mouse cursors that are available via constants in the Cursor class, also located in the javafx.scene package. Here's a screenshot of this program:

Mousecursorssven

Sven's examples have full source code and JNLP links, so go check them out and learn some Mighty Mouse handling. Thanks again, Sven!

Jim Weaver
JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications

Immediate eBook (PDF) download available at the book's Apress site

_mighty_mouse

 

Bitbucket is the Git solution for professional teams who code with a purpose, not just as a hobby. Get started today, it's free.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}