JAVA FX Change CSS of a button by Key Event

403
January 01, 2017, at 10:37 PM

I have a button which changes it`s design when it is clicked. (Per CSS) Easy.

But i also wanted to enable the function that if you press ENTER it should also be pressed. That works, but I have a pseudoclass which sets the size of the button to 90% (.button:pressed).

Problem: It doesn`t work when the enter key is pressed. The click works fine. Is there any css pseudoclass for key typed or so?

Using SceneBuilder

CSS:

.button{
        -fx-background-image: url("../resources/Game/cookie.png");
        -fx-background-color: transparent;
}
.button:pressed{
    -fx-background-size: 90%;
    -fx-background-position: center;
}

Thank you in advance :)

Rent Charter Buses Company
READ ALSO
Why is rem behaving like an em with this code?

Why is rem behaving like an em with this code?

Why is rem behaving like an em with this code?

281
How to keep height of div fixed when it content changed?

How to keep height of div fixed when it content changed?

I have a div that contains other divsSomething like this:

407
i need to change a frame's source accoring to champion hovered

i need to change a frame's source accoring to champion hovered

so I have an unordered list of champions, and each of them have a link in them, so i want my frame's src to change to that champ's page if he is being hovered on, I currently have this jscript code

278
how to have content not disappear after animation?

how to have content not disappear after animation?

i am using the animatecss and wow

339