private void updateCardView() { final Optional<Card> card = stack.viewTop(); if (card.isPresent()) { cardView.setCard(card.get()); } else { cardView.removeCard(); } }
public StackView( final Context context, final CardImager imager, final Stage stage, final CardStack stack) { super(context); this.stack = stack; stack.register(this); cardView = new CardView(context, imager, stage); cardView.setParent(this); stackSize = new Label(); stackSize.getStyleClass().add(STYLE_STACK_SIZE); stackSize.setMouseTransparent(true); pane = new StackPane(); pane.getChildren().add(cardView.getPane()); pane.getChildren().add(stackSize); setPane(pane); updateStackSizeLabel(); updateCardView(); }
private void updateStackSizeLabel() { stackSize.setText(Integer.toString(stack.size())); }