dimanche 1 mars 2015

Why setStyle for -fx-background-image and -fx-image not working?

I can't understand why I cannot change picture (background of field and image of imageview) from this method:



private void loginCheck(String loginText){
String login = loginText.trim();
if(login == null || login.equals("")) {
loginField.setStyle("-fx-background-image:url('images/registration_login_wrong.png');");
logoTick.setStyle("-fx-image:url('images/registration_wrong.png');");
logoTick.setVisible(true);
}else{
loginField.setStyle("-fx-background-image:url('images/registration_login_right.png');");
logoTick.setVisible(false);
}
}


CSS code for logoTick is:



.login_tick{
-fx-image:url("images/registration_tick.png");
visibility:false;}


Everything besides -fx-image and -fx-background-image seems to work fine. I also changed background image in another class(of a label) and didn't encounter any problems. That's why I can't understand what can be possibly wrong. I checked images location and name everything seems correct. If I manually replace image path in CSS it is working, but from the code images just disappear.


Aucun commentaire:

Enregistrer un commentaire