Well, I bet you coded it the obvious way by using the setOnKeyPresse9) or setOnKeyReleased() method of the ComboBox class. For explanations that I still do not understand and do not care as long as it worked, user James D from the Oracle forum stated that the space, enter and escape key do not register because the button itself of the ComboBox captures that event (and propagates it as an action event), thus consuming it before your event handler.

The solution to this is not to use addEventHandler() but instead use addEventFilter().

This is how to call it:

You should now be able to capture the escape, enter and space key events.

In Swing, an image button is possible by setting the background color of the JButton to transparent and the image will still show its pressed and normal state effect when clicked.

In Java FX 2 however, when you add an image to the Button control and set the background to transparent using -fx-background-color: transparent, you are left with a static image that does not move whenever you click on it.

There is no ready made class in Java FX 2 that does this so the only solution left is to make one. What I did is extend from Button class and simulate the pressed and released effect by changing the padding values whenever a mouse event occurs.

That’s it! It is as simple as that.

I think it started with Java 1.6 that a JNLP jar file was included that can let you run a Java web start application or applet in a single instance.

Through the SingleInstanceService class, you application or applet will be able to detect if another instance is run when it is called from a JNLP.

I have not tried this with an applet that is run from an <APPLET> tag but I tested this in an applet if it is called from a JNLP.

Simply implement SingleInstanceListener from your class and initialize it with this code:

And in the newActivation() method, you can put in a message prompt that looks something like this:

Easy, right?

By the way, if this code is run within an IDE, it will return an exception. This will have to be run from a JNLP in order for it to work.

Related Posts Plugin for WordPress, Blogger...