10 March 2021

Time to Play!

Question Time I am going to ask you questions, picking someone at random.

  1. What type of variable can have a lambda assigned to it?
  2. What do MenuItems and Buttons have in common?
  3. Where do you normally put a menu bar in a Stage?
  4. What is the correct order of occurence of these events?
    • stop is called.
    • init is called.
    • start is called.
    • constructor executes.
  5. How does an HBox act if several items are added it it?
  6. How does a VBox act if several items are added it it?

Answers

  1. Variables of functional interface type.
  2. Both have a setOnAction Method.
  3. It goes in the top of a BorderPane.
  4. 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.