CS 1102 - AY2019-T4_ Discussion Assignment.pdf - CS 1102 AY2019-T4 Discussion Assignment HOME CONTACT US RESOURCES LINKS FACULTY MY COURSES MENU CS 1102

CS 1102 - AY2019-T4_ Discussion Assignment.pdf - CS 1102...

This preview shows page 1 - 3 out of 23 pages.

6/8/2019 CS 1102 - AY2019-T4: Discussion Assignment 1/23 Home My courses CS 1102 - AY2019-T4 30 May - 5 June Discussion Forum Unit 8 Discussion Assignment Subscribe HOME CONTACT US RESOURCES LINKS FACULTY MY COURSES MENU     Search forums Discussion Assignment by Eric Goh (Instructor) - Thursday, 11 April 2019, 5:16 PM Describe the concepts of messaging, events, and listeners as they relate to developing GUI applications within java. As part of your discussion include a description of the role of event handlers. 31 words Permalink | Reply Re: Discussion Assignment by Dalton Overlin - Saturday, 1 June 2019, 4:49 AM How Messaging Events and Listeners Relate to GUI Applications What Messaging means in a GUI environment is that "messaging is a method of communication between software components or applications" (The Java EE 6 Tutorial, n.d.). In short, messaging allows GUI components to communicate with each other, and
Image of page 1

Subscribe to view the full document.

6/8/2019 CS 1102 - AY2019-T4: Discussion Assignment 2/23 the rest of the program by sending data like messages, just like how actual parameters are sent to formal parameters in subroutines. While events are things like the click of a mouse on a GUI button or the pressing of a key on a keyboard that can send data to the active GUI window. While a listener is a piece of code that actively checks for input such as events like mouse clicks or buttons being pressed on a keyboard. Now that messaging events and listeners have been explained above, I will now explain how "they relate to developing GUI applications", and will continually refer to my example program below during the explanation. Messaging when developing a GUI program is the data types and values that will be sent between di±erent components of the program. In my example program, when the button is clicked it sends a message to the ActionListener, then to ActionPerformed which then runs the System.out.print(action); that prints out the message that was sent from the button click and initiates the System.exit(0); statement that closes the program. The text output below also shows the message that was sent when the button was clicked, allowing you to see how GUI components can communicate with the rest of the program. Moving on to the next topic of events, such as mouse clicks, when developing GUI programs you may want your program to respond to di±erent types of events in di±erent ways. My example program responds to mouse clicks on the button, by closing the program. While a more complex program could respond to an event like buttons being pressed on a keyboard, and much more by de²ning how the program will respond to di±erent types of events. While listeners in GUI programs will listen for input so that a speci²c task can be carried out when an event is detected. My program adds an event listener to the variable closeMeButton so that when an event, such as a click on that button will carry out the print statement and the statement that closes the program.
Image of page 2
Image of page 3
  • Fall '18

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes