Final project.

Slides:



Advertisements
Similar presentations
Mouse Listeners We continue our examination of GUIs by looking at how to interact with the mouse –Just as Java creates Events when the user interacts with.
Advertisements

Event Handling.
Managing Input Events in Swing Week 5 Workshop Lyn Bartram.
Computer Science 209 Graphics and GUIs. Working with Color The class java.awt.Color includes constants for typical color values and also supports the.
Fall 2007CS 225 Graphical User Interfaces Event Handling Appendix C.
Event-Driven Programming Thus far, our programs have been executed one statement after the other However, many programs depend on user actions to dictate.
Event Handling Events and Listeners Timers and Animation.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 14 GUI and Event-Driven Programming.
Intermediate Java1 An example that uses inner classes Week Four Continued.
GUI. Swing Class Hierarchy Swing Components Swing Conatiners  JFrame – top-level window to store components.
EVENTS CSC 171 FALL 2004 LECTURE 16. “Traditional” Input In console applications, user input is under control of the program The program asks the user.
GUI Event Handling Nithya Raman. What is an Event? GUI components communicate with the rest of the applications through events. The source of an event.
More on Creating GUIs in Java using Swing David Meredith Aalborg University.
PROGRAMMING REVIEW Lab 2 EECS 448 Dr Fengjun Li and Meenakshi Mishra.
Mouse Events. Handling Mouse Events Java provides two listener interfaces to handle mouse events: MouseListener;  MouseListener;  MouseMotionListener.
More Event Handling Adapters Anonymous Listeners Pop menus Validating User Input.
Chapter 12 Event Handling. Chapter Goals To understand the Java event model To install action and mouse event listeners To accept input from buttons,
CS 11 java track: lecture 4 This week: arrays interfaces listener classes inner classes GUI callbacks.
Java GUI’s are event driven, meaning they generate events when the user interacts with the program. Typical events are moving the mouse, clicking a mouse.
CSE 501N Fall ‘09 20: Event Handling and Inner Classes 17 November 2009 Nick Leidenfrost.
Previous programs used a JLabel for OUTPUT. Another Swing component that can be used for both user input and output is the JTextfield. Suppose we want.
Fall 2006Adapded from Java Concepts Companion Slides1 Event Handling Advanced Programming ICOM 4015 Lecture 13 Reading: Java Concepts Chapter 12.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Java's Graphical User Interface Toolkit
COMP 321 Week 2. Outline Event-Driven Programming Events, Event Sources, Event Listeners Button and Timer Events Mouse Events, Adapters.
EE2E1. JAVA Programming Lecture 6 Event handling and building user interfaces with Swing.
Graphical User Interfaces (Part 2) 1. View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user.
For (int i = 1; i
Event Handling. 2 GUIs are event driven –Generate events when user interacts with GUI e.g., moving mouse, pressing button, typing in text field, etc.
CS1054: Lecture 21 - Graphical User Interface. Graphical User Interfaces vs. Text User Interface.
Understand the difference between applets and applications Identify meaningful applet resources for academic subjects Create and demonstrate a basic Java.
CMSC 341 Making Java GUIs Functional. 09/29/2007 CMSC 341 Events 2 More on Swing Great Swing demo at /demos/jfc/SwingSet2/SwingSet2Plugin.html.
Java GUI. Overview The ”idea” The ”idea” The Components The Components Listeners Listeners The Program The Program Interface Eventlistener Interface Eventlistener.
EE2E1. JAVA Programming Lecture 6 Event handling and building user interfaces with Swing.
CHAPTER 10 EVENT HANDLING. CHAPTER GOALS To understand the Java event model To install mouse and action listeners To accept mouse and text input To display.
The Swing GUI Components Chapter 29 An enhanced alternative to AWT The PC does not need an appletviewer or browser Swing overcomes some AWT drawbacks.
Mouse Listeners Moving the mouse will also generate events like the Timer –To have your program respond, you must implement either or both of MouseListener.
Event-Driven Programming CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
CS Lecture 04 Mice Lynda Thomas
1 Event Handling – Lecture 4 Prepared by: Ahmad Ramin Rahimee Assistant Professor ICTI.
1/18H212Mouse and Timer Events H212 Introduction to Software Systems Honors Lecture #16: Mouse and Timer Events October 26, 2015.
Event Listeners ActionListener –button,list AdjustmentListener-scroll bar ComponentListener-when component hidden…. ContainerListener-comp added or removed.
Mouse Events GUI. Types of Events  Below, are some of the many kinds of events, swing components generate. Act causing EventListener Type User clicks.
View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user interface element (the user interface.
TENTH LECTURE Event and listener. Events and Listeners An event can be defined as a type of signal to the program that something has happened. The event.
Dept. of CSIE, National University of Tainan 10/21/2012 Responding to User Input.
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit7: Event-driven programming 1.
Chapter 6 Building Java GUIs. MVC Model View Controller The model passes its data to the view for rendering The view determines which events are passed.
Events and Event Handling
Chapter 14 Event-Driven Programming
Java Applets.
Lecture 8 Object Oriented Programming Using Java
Chapter 12 Event-Driven Programming
Handling User Events with Swing
Advanced User Interfaces
Computer Science 209 Graphics and GUIs.
GUI III IS
Programming in Java Event Handling
GUI Event Handling Nithya Raman.
GUI Programming III: Events
CSE Software Engineering Fall 1999 Updated by J. Brown
Event-driven programming for GUI
Chapter 12 Event Handling
Java Applets.
Web Design & Development Lecture 12
Chapter 16 Event-Driven Programming
Graphical User Interfaces in Java Event-driven programming
Events, Event Handlers, and Threads
Making Java GUIs Functional
CS Problem Solving and Object Oriented Programming Spring 2019
Presentation transcript:

Final project

Design your own user interface, but the project has to include the following components and event handlers JFrame JPanel JButton JCheckBox JTextField JMenuBar, JMenu, JMenuItem Either ActionListener, ItemListener or MouseListener

Remarks Make the GUI pleasant-looking, clear and clean. DO NOT COPY from anywhere or anybody. Do your own work.

example

ItemListener Refer to the slide slide06-0moreGUI

MouseListener Done on the class level 5 methods have to be implemented public class <ClassName> implements MouseListner{.. 5 methods have to be implemented public void mousePressed(MouseEvent evt); public void mouseReleased(MouseEvent evt); public void mouseClicked(MouseEvent evt); public void mouseEntered(MouseEvent evt); public void mouseExited(MouseEvent evt); you can leave the body of a method empty if you don’t want to implement the method.

MouseListener Done on the component’s level Still need to implement all 5 methods, leave the body of a method empty if you don’t want to implement the method Next slide show how it is done

txtLog.addMouseListener(new MouseListener() { public void mouseEntered(java.awt.event.MouseEvent evt) { System.out.println("mouse entered”); } public void mouseExited(java.awt.event.MouseEvent evt) { System.out.println("mouse exit..“); } public void mouseClicked(MouseEvent evt){ System.out.println("mouse clicked”); } public void mouseReleased(MouseEvent evt){ System.out.println("mouse released”); } public void mousePressed(MouseEvent evt){ System.out.println(“mouse pressed..“); float hue = (float)Math.random(); txtLog.setBackground( Color.getHSBColor(hue, 1.0F, 1.0F) ); }