Time to Play!
Question Time I am going to ask you questions, picking someone at random.
- What type of variable can have a lambda assigned to it?
- What do MenuItems and Buttons have in common?
- Where do you normally put a menu bar in a Stage?
- What is the correct order of occurence of these events?
- stop is called.
- init is called.
- start is called.
- constructor executes.
- How does an
HBox
act if several items are added it it? - How does a
VBox
act if several items are added it it?
Answers
- Variables of functional interface type.
- Both have a setOnAction Method.
- It goes in the top of a BorderPane.
- What is the correct order of occurence of these events?
- constructor
- init
- start
- stop
- They fill in horizontally.
- They fill in vertically
For this exercise you will need to learn how to use a GridPane. Put it in the center of a border pane and put a textfield on the top. Place a 0 in the text field.
Put the number buttons into the GridPane, which you will place in the center of the GridPane.
----------------------------------------- | Put a textfield here with a 0 in it | ----------------------------------------- | 7 | 8 | 9 | | | 4 | 5 | 6 | | | 1 | 2 | 3 | | | . | 0 | E | | -----------------------------------------
I will enable screen sharing and we can look at what everyone is doing.