Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 21 ■ Questions and answers: Finishing the setup Methods and digital audio


a1Button = new Button();
a1Button.setText("Answer Choice 1");
a1Button.setFont(Font.font("Arial Black", 33 ));
a1Button.setMaxSize(350, 140 );
a1Button.setTranslateY(-240);
a2Button = new Button();
a2Button.setText("Answer Choice 2");
a2Button.setFont(Font.font("Arial Black", 33 ));
a2Button.setMaxSize(350, 140 );
a2Button.setTranslateY(-80);
a3Button = new Button();
a3Button.setText("Answer Choice 3");
a3Button.setFont(Font.font("Arial Black", 33 ));
a3Button.setMaxSize(350, 140 );
a3Button.setTranslateY( 80 );
a4Button = new Button();
a4Button.setText("Answer Choice 4");
a4Button.setFont(Font.font("Arial Black", 33 ));
a4Button.setMaxSize(350, 140 );
a4Button.setTranslateY( 240 );
}


As you can see in Figure 21-19, the Q&A UI Panel is now in the lower-left corner of your game board
view. The Buttons are large and close together with nice, large, readable text, and the question answer user
interface is out of the way of each of your digital image assets (the visual component of the game) and now
looks quite professional.


Figure 21-18. Recalibrate the createQAnodes() settings to adjust the Q&A Panel location, size, Button spacing,
and font

Free download pdf