Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is study gide for the next test. Can you please give me any good examples f

ID: 675105 • Letter: T

Question

This is study gide for the next test. Can you please give me any good examples
for these study gide so that i can memorize and get way how to study ?

GUI Outcome (Ch 14-16)

7 Explain what event-driven programming is.

8 Explain the process of building a GUI in JavaFX.

9 Know these panes: HBox, VBox, GridPane and how to add controls or nested panes.

10 Know these controls: Label, TextField, TextArea, Button

11 Know how to maintain state in a GUI application.

12Explain the concept of nesting panes and why it is useful.

13 Write code to build a simple GUI.

14 Given an inner class event handler, write code to implement the handle method.

15 Write code to register an inner class event handler with a control.

Explanation / Answer

7) An event-driven application is a computer program that is written to respond to actions generated by the user or the system. In a computing context, an event is any identifiable occurrence that has significance for system hardware or software. As such, events include both user-generated actions like mouse clicks and keystrokes and system-generated events such as program loading. EventDrivenProgramming work when there is no clear distinction between events, or when signals are temporally ambiguous (where a signal might mean one of many things based on what happens next or what happened previously). EventDrivenProgramming is for dumb reaction to obvious stimuli... not much more behavioral 'intelligence' than a Jellyfish.

8) Process of building a GUI in JavaFX.

9) HBOX - The HBox layout pane provides an easy way for arranging a series of nodes in a single row.The padding property can be set to manage the distance between the nodes and the edges of the HBox pane. Spacing can be set to manage the distance between the nodes. The style can be set to change the background color.

VBOX - The VBox layout pane is similar to the HBox layout pane, except that the nodes are arranged in a single column.The padding property can be set to manage the distance between the nodes and the edges of the VBox pane. Spacing can be set to manage the distance between the nodes. Margins can be set to add additional space around individual controls.

GridPane - The GridPane layout pane enables you to create a flexible grid of rows and columns in which to lay out nodes. Nodes can be placed in any cell in the grid and can span cells as needed. A grid pane is useful for creating forms or any layout that is organized in rows and columns.

Nested Pane - Nested pane is a group to a FlowLayoutPanel and add all of these panels to a main FlowLayoutPanel. Now, if if I add the child FlowLayoutPanels to the main (mainPanel.Controls.Add(childPanel)) before adding the Controls to the child, the Controls are drawn properly. If I add all of the Controls to the child FlowLayoutPanel then add the panel to the main panel, all of the Controls are drawn in-properly.

10)

Label - This is probably the first control you will master. It is used to display static text, titles and screen output from operations.

TextField - An instance of the TextField class represents a text field in a Text Control document. A text field is a marked piece of text that has properties like text or a name. The TextControl class has several events that inform about different occurrences.

TextArea -

The <textarea> tag defines a multi-line text input control.A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier).The size of a text area can be specified by the cols and rows attributes, or even better; through CSS' height and width properties.

Button - he Windows Forms Button control allows the user to click it to perform an action. The Button control can display both text and images. When the button is clicked, it looks as if it is being pushed in and released.

11)

GUI programming in functional and logic languages tends to feel quite hard. There is nothing intrinsic in FP that makes GUI programming extra hard, but when everywhere else you are surrounded by nice, abstract, compositional, high-level descriptive definitions, working at the GUI’s low level feels.

Using POST/GET is usually best if you just have one page "talking" to one other page (e.g. submission of a form). If you have a bunch of data that will be shared by several pages, the best way to do it would probably be to put them in the session. If you need those values to stick around after the user leaves your site and comes back later, then you might want to use cookies.

12)

As described in Nest Buses, any signal in a bus can be another bus, which can in turn contain subordinate buses, and so on to any depth. Describing nested buses with bus objects requires nesting the bus definitions that the objects provide.

Every pane object inherently defines a data type whose properties are those specified by the object. To nest one bus definition in another, you assign to an element of one bus object a data type that is defined by another bus object. The element then represents a nested bus whose structure is given by the bus object that provides its data type.

A data type defined by a pane object is called a pane type. Nesting pane by assigning bus types to elements, rather than by subordinating the pane objects that define the types, allows the same pane definition to be used conveniently in multiple contexts without unwanted interactions. To specify that an element of a pane object represents a nested pane definition:

Create a nested element to represent the nested pane definition, in the appropriate position under the containing pane object, and give the element the desired name.

Use the Dialog pane to set the data type of the element to the name of a pane object. The Data Type Assistant shows the names of all available pane types.

13)

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class GuiApp1 {

    public static void main(String[] args) {
      
        new GuiApp1();
    }

    public GuiApp1()
    {
        JFrame guiFrame = new JFrame();
      
        //make sure the program exits when the frame closes
        guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        guiFrame.setTitle("Example GUI");
        guiFrame.setSize(300,250);
    
        //This will center the JFrame in the middle of the screen
        guiFrame.setLocationRelativeTo(null);
      
        //Options for the JComboBox
        String[] fruitOptions = {"Apple", "Apricot", "Banana"
                ,"Cherry", "Date", "Kiwi", "Orange", "Pear", "Strawberry"};
      
        //Options for the JList
        String[] vegOptions = {"Asparagus", "Beans", "Broccoli", "Cabbage"
                , "Carrot", "Celery", "Cucumber", "Leek", "Mushroom"
                , "Pepper", "Radish", "Shallot", "Spinach", "Swede"
                , "Turnip"};
      
        //The first JPanel contains a JLabel and JCombobox
        final JPanel comboPanel = new JPanel();
        JLabel comboLbl = new JLabel("Fruits:");
        JComboBox fruits = new JComboBox(fruitOptions);
      
        comboPanel.add(comboLbl);
        comboPanel.add(fruits);
      

        final JPanel listPanel = new JPanel();
        listPanel.setVisible(false);
        JLabel listLbl = new JLabel("Vegetables:");
        JList vegs = new JList(vegOptions);
        vegs.setLayoutOrientation(JList.HORIZONTAL_WRAP);
        
        listPanel.add(listLbl);
        listPanel.add(vegs);
      
        JButton vegFruitBut = new JButton( "Fruit or Veg");
      
        vegFruitBut.addActionListener(new ActionListener()
        {
  
            public void actionPerformed(ActionEvent event)
            {
               listPanel.setVisible(!listPanel.isVisible());
               comboPanel.setVisible(!comboPanel.isVisible());

            }
        });
      
        guiFrame.add(comboPanel, BorderLayout.NORTH);
        guiFrame.add(listPanel, BorderLayout.CENTER);
        guiFrame.add(vegFruitBut,BorderLayout.SOUTH);
      
        guiFrame.setVisible(true);
    }
  
}

14)

15)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote