Код: Выделить всё
public void setChosenItem (Ardealya item) {
if (item == null) return;
Platform.runLater(() -> {
nameLabel.setText(item.getItemName());
priceLabel.setText("Php " + item.getPrice());
descriptionLabel.setText(item.getDescription());
// Ensure the image is updated correctly
Image image = new Image(getClass().getResourceAsStream(item.getImageSource()));
ImageChosen.setImage(image);
buyPanel.setVisible(true);
// Force the layout to update
buyPanel.requestLayout();
});
System.out.println("\nName Label Updated: " + nameLabel.getText());
System.out.println("Price Label Updated: " + priceLabel.getText());
System.out.println("Description Label Updated: " + descriptionLabel.getText());
System.out.println("Image Updated: " + item.getImageSource());
}
Я попробовал реле, которое заставляет пользовательский интерфейс обновляться, но мне это тоже не помогает.
Подробнее здесь: https://stackoverflow.com/questions/792 ... -in-javafx
Мобильная версия