Presentation is loading. Please wait.

Presentation is loading. Please wait.

GUI Programming Joseph Sant Sheridan College. Agenda Elements of GUI programming Component-Based Programming. Event-Based Programming. A process using.

Similar presentations


Presentation on theme: "GUI Programming Joseph Sant Sheridan College. Agenda Elements of GUI programming Component-Based Programming. Event-Based Programming. A process using."— Presentation transcript:

1 GUI Programming Joseph Sant Sheridan College

2 Agenda Elements of GUI programming Component-Based Programming. Event-Based Programming. A process using a powerful IDE.

3 GUI Programming - Components GUI programming is done using pre-built components such as textboxes, buttons, radio buttons etc. Programmer will set and programmatically reset properties of these components. The components are capable of detecting events that happen to them (such as someone clicking on them). The programmer might attach an event listener to the component to perform a task when a specific event occurs.

4 Event-Driven Component Programming Layout appropriate components on a container component. Some components might allow the user to trigger an action. The programmer might want the program to perform some task when that action occurs (e.g. someone clicking on a button)

5 Event-Driven Component Programming Go Do this. If button clicked do this If radiobutton clicked do this If slider moved do this Go Sequential Event-Driven

6 Event-Driven Programming. In standard sequential programming, the programmer is in control of what is done and when it is done. In event-driven programming the programmer is still in control of what is done but loses control over when it is done. The user is in control of when a task is done.

7 Event Listeners. Event Listeners are objects or functions or methods that code a response to a specific event.

8 Event-Driven Component Programming EXAMPLE A button on a calculator program might add the numbers in two text fields when clicked. The programmer would have to attach an event listener to the click event of a button. The event listener contains code that parses the two text fields. add the numbers together. resets another field to the result of the addition.

9 Components/Widgets There are many components that can be used to develop GUI applications: –Text boxes –Radio Buttons –List Boxes –Combo boxes Containers are used to display several components or other container classes. –Frames. –Panels.

10 Layout Different schemes can be used to arrange the components on a screen. –Linear –Table –Grid –Others

11 Layouts LinearTableGrid

12 Developing GUI programs using a powerful IDE. Create a Android Application project. Add an Activity. Drag or select components from the pallette and position them on the form. Context menus for a given control typically allow you to select a number of possible listeners for a given event.

13 Questions? What is a listener? When are listener methods executed. Can you write a listener that never executes in a given program? Are layouts and containers the same thing?


Download ppt "GUI Programming Joseph Sant Sheridan College. Agenda Elements of GUI programming Component-Based Programming. Event-Based Programming. A process using."

Similar presentations


Ads by Google