Chapter 13 Graphical User Interface Components: Part 2 (Web hosting comparison)

Chapter 13 Graphical User Interface Components: Part 2 783 JButton buttons[0] (lines 53 54) has weightx and weighty values of 1. The fill variable is BOTH. Because buttons[0] is not one of the last two components on the row, it is given a gridwidth of 1 so it will occupy one column. The JButton is added to the content pane with a call to utility method addComponent. JButtonbuttons[1] (lines 57 58) has weightx and weighty values of 1. The fill variable is BOTH. Line 57 specifies that the JButton is to be placed relative to the previous component. The Button is added to the JFrame with a call to addComponent. JButton buttons[2] (lines 61 62) has weightx and weighty values of 1. The fill variable is BOTH. This JButton is the last component on the line, so REMAINDER is used. The JButton is added to the content pane with a call to utility method addComponent. The JComboBox button (lines 65 67) has a weightx 1 and a weighty 0. The JComboBox will not grow in the vertical direction. The JComboBoxis the only component on the line, so REMAINDER is used. The JComboBox is added to the content pane with a call to utility method addComponent. JButton buttons[3] (lines 70 72) has weightx and weighty values of 1. The fill variable is BOTH. This JButton is the only component on the line, so REMAINDER is used. The JButton is added to the content pane with a call to utility method addComponent. JButton buttons[4] (lines 75 76) has weightx and weighty values of 1. The fill variable is BOTH. This JButton is the next-to-last component on the line, so RELATIVE is used. The JButton is added to the content pane with a call to utility method addComponent. The JList component (lines 79 80) has weightx and weighty values of 1. The fill variable is BOTH. The JList is added to the content pane with a call to utility method addComponent. 13.17 (Optional Case Study) Thinking About Objects: Model- View-Controller Design patterns describe proven strategies for building reliable object-oriented software systems. Our case study adheres to the Model-View-Controller (MVC) architecture, which uses several design patterns.1 MVC divides system responsibilities into three parts: 1. the model, which contains all program data and logic; 2. the view, which provides a visual presentation of the model and 3. the controller, which defines the system behavior by sending user input to the model. Using the controller, the user changes the data in the model. The model then informs the view of the change in data. The view changes its visual presentation to reflect the changes in the model. For example, in our simulation, the user adds a Person to the model by pressing either the First Floor or Second Floor JButton in the controller (see Fig. 2.22 1. For those readers who seek further study in design patterns and MVC architecture, we encourage you to read our Discovering Design Patterns material in Sections 1.16, 9.24, 13.18, 15.13, 17.11 and 21.12
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply