Presentation is loading. Please wait.

Presentation is loading. Please wait.

PROGRAMMING 2 CS 112 LAB 9_1 TA: Nouf Al-Harbi TA: Hanan Al-mukhalfi TA: Sara Abu Alnaser TA: Nada Al-amoudi.

Similar presentations


Presentation on theme: "PROGRAMMING 2 CS 112 LAB 9_1 TA: Nouf Al-Harbi TA: Hanan Al-mukhalfi TA: Sara Abu Alnaser TA: Nada Al-amoudi."— Presentation transcript:

1 PROGRAMMING 2 CS 112 LAB 9_1 TA: Nouf Al-Harbi TA: Hanan Al-mukhalfi TA: Sara Abu Alnaser TA: Nada Al-amoudi

2 LAB OBJECTIVES  GUI : GUI Nodes Radio button Checkbox Propereties Background Color Style Font class HBox layout Exercise. 1 رجب 1436 Lab10_1, Programming 2 2

3 1 رجب 1436 Lab10_1, Programming 2 3 LAB EXERCISE

4 Stage with size 600*250 5 radio buttons in Hbox Pane 2 check boxes in Hbox Pane A TextField A GridPane with 1.Alignment: Pos.CENTER 2. Horizontal gap: 10 3. Vertical gap: 10 4. Padding: Insets(5,5,5,5) 1 رجب 1436 Lab10_1, Programming 2 4

5 GUI Helper 1 رجب 1436 Lab10_1, Programming 2 5

6 THE FONT CLASS You can create a font using the javafx.scene.text.Font class and set fonts for the components using the setFont method in the node class. The constructor for Font is: public Font(String name, double size); You can :  choose a font name from SansSerif, Serif, …etc.  Specify a font size of any positive integer. 1 رجب 1436 Lab10_1, Programming 2 6

7 FONT CLASS 1 رجب 1436 Lab10_1, Programming 2 7

8 THE FONT CLASS ( CON’T) EX: the following statements create two fonts and set one font to a button. Font font1 = new Font("SansSerif", 16); Font font2 = Font.font("Times New Roman", FontWeight.BOLD, FontPosture.ITALIC, 12); Button btOK = new Button("OK"); btOK.setFont(font1); 1 رجب 1436 Lab10_1, Programming 2 8

9 THE FONT CLASS ( CON’T) You can :  choose a font name from SansSerif, Serif, …etc.  Choose a FontWeight from FontWeight.BOLD, FontWeight.Extra_BOLD, FontWeight.LIGHT ….. Etc.Font.  Choose a FontPosture from FontPosture. ITALIC, FontPosture. REGULAR  Specify a font size of any positive integer. 1 رجب 1436 Lab10_1, Programming 2 9

10 1 رجب 1436 Lab10_1, Programming 2 10

11 2. HBOX LAYOUT Hbox: An HBox lays out its children in a single horizontal row. 1 رجب 1436 Lab10_1, Programming 2 11

12 1 رجب 1436 Lab10_1, Programming 2 12

13 RadioButton 1 رجب 1436 Lab10_1, Programming 2 13

14 CheckBox 1 رجب 1436 Lab10_1, Programming 2 14

15 TOGGLEGROUP To group radio buttons, you need to create an instance of javafx.scene.control.ToggleGroup and use the setToggleGroup(group); method to add them to it, as follows: RadioButton r1 = new RadioButton("Student"); RadioButton r2 = new RadioButton(“Teacher"); ToggleGroup group = new ToggleGroup(); r1.setToggleGroup(group); r2.setToggleGroup(group); 1 رجب 1436 Lab10_1, Programming 2 15

16 1 رجب 1436 Lab10_1, Programming 2 16

17 1 رجب 1436 Lab10_1, Programming 2 17

18 1 رجب 1436 Lab10_1, Programming 2 18

19 1 رجب 1436 Lab10_1, Programming 2 19

20 1 رجب 1436 Lab10_1, Programming 2 20

21 1 رجب 1436 Lab10_1, Programming 2 21

22 1 رجب 1436 Lab10_1, Programming 2 22

23 1 رجب 1436 Lab10_1, Programming 2 23

24 1 رجب 1436 Lab10_1, Programming 2 24

25 1 رجب 1436 Lab10_1, Programming 2 25

26 THANK YOU Any question 1 رجب 1436 Lab10_1, Programming 2 26


Download ppt "PROGRAMMING 2 CS 112 LAB 9_1 TA: Nouf Al-Harbi TA: Hanan Al-mukhalfi TA: Sara Abu Alnaser TA: Nada Al-amoudi."

Similar presentations


Ads by Google