动态更改FontAwesomeIconView

时间:2019-06-01 17:09:09

标签: java javafx

我正在尝试更改public String longestCommonPrefix(String[] strs) { if (strs.length == 0) return ""; int prefixLength = strs[0].length(); for (int i = 1; i < strs.length; i++) { int s = 0; while (s < prefixLength && s < strs[i].length() && strs[0].charAt(s) == strs[i].charAt(s)) { ++s; } prefixLength = s; } return strs[0].substring(0, prefixLength); } enter image description here

控制器已定义:

FontAwesomeIconView

我检查用户是否在其最喜欢的列表中有选定的拍卖,如果是,则更改图标(@FXML private FontAwesomeIconView star; public void initializeNow() { try { if(!client.getUser().getFavoriteList().contains(client.getAuction(auction.getId()))) { //Se l'asta non e' tra le preferite star = new FontAwesomeIconView(FontAwesomeIcon.STAR_ALT); } else { star = new FontAwesomeIconView(FontAwesomeIcon.STAR); } ...} ),但不更改。为什么?

0 个答案:

没有答案