Add: profile picture loading in PlayerStatusController

This commit is contained in:
Julian Kropff
2026-05-13 17:55:37 +02:00
parent aad00bda0b
commit 59f1763926
@@ -20,15 +20,19 @@ public class PlayerStatusController {
private static final Logger LOGGER = Logger.getLogger(PlayerStatusController.class.getName());
@FXML private Label playerName;
@FXML private Label playerMoney;
@FXML private ImageView dealerIcon;
@FXML private Pane parent;
@FXML private VBox playerStatusBox;
@FXML private HBox statusInnerBoxTop;
@FXML private HBox statusInnerBoxBottom;
@FXML Label playerName;
@FXML Label playerMoney;
@FXML ImageView dealerIcon;
@FXML ImageView playerProfileImage;
@FXML Pane parent;
@FXML VBox playerStatusBox;
@FXML HBox statusInnerBoxTop;
@FXML HBox statusInnerBoxBottom;
private Image dealerImage;
// Profile images (loaded from resources/images/profile-picture)
private Image profileUserImage;
private Image profileDealerImage;
private Player player;
private boolean turnHighlighted;
private static final String DEALER_IMAGE_PATH = "/images/chip-dealer-blue-5.png";
@@ -53,6 +57,26 @@ public class PlayerStatusController {
LOGGER.log(Level.SEVERE, "Error loading dealer image", e);
}
try {
var base = "/images/profile-picture/";
var uUser = getClass().getResource(base + "poker_user_491.png");
var uDealer = getClass().getResource(base + "poker_dealer_471.png");
if (uUser != null) {
profileUserImage = new Image(uUser.toExternalForm(), true);
}
if (uDealer != null) {
profileDealerImage = new Image(uDealer.toExternalForm(), true);
}
if (playerProfileImage != null && profileUserImage != null) {
playerProfileImage.setImage(profileUserImage);
}
} catch (Exception e) {
LOGGER.log(Level.FINE, "Could not load profile images", e);
}
dealerIcon.layoutXProperty().bind(parent.widthProperty().multiply(DEALER_ICON_X_FACTOR));
dealerIcon.setVisible(false);
}
@@ -160,6 +184,14 @@ public class PlayerStatusController {
if (isDealer && dealerImage != null) {
dealerIcon.setImage(dealerImage);
}
if (playerProfileImage != null) {
if (isDealer && profileDealerImage != null) {
playerProfileImage.setImage(profileDealerImage);
} else if (profileUserImage != null) {
playerProfileImage.setImage(profileUserImage);
}
}
}
/**