CS12420 - Lecture 00 Swing overview and introduction Lynda Thomas

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

Fall 2007CS 225 Graphical User Interfaces Event Handling Appendix C.
Unit 091 Introduction to GUI Programming Introduction to User Interfaces Introduction to GUI Programming GUI Design Issues GUI Programming Issues Java.
1 Chapter 7 Graphics and Event Handling. 2 Overview The java.awt and javax.swing packages and their subpackages support graphics and event handling. Many.
Event Handling Events and Listeners Timers and Animation.
Graphical User Interfaces (GUIs) GUI: An application that uses graphical objects to interact with users GUI applications consist of: –Events: A user or.
Swing CS-328 Dick Steflik John Margulies. Swing vs AWT AWT is Java’s original set of classes for building GUIs Uses peer components of the OS; heavyweight.
GUI Programming in Java Tim McKenna GUI Programming Concepts l conventional programming: sequence of operations is determined by the program.
Java Swing - Lecture 1 An Introduction Milena Radenkovic slides originally by Chris Coleman.
A.k.a. GUI’s.  If you want to discuss your Lab 2 grade come see me this week. ◦ Office: 436 ERB. One hour prior to class ◦ Open to Appointments MWF 
GUI Programming in Java
ACM/JETT Workshop - August 4-5, ExceptionHandling and User Interfaces (Event Delegation, Inner classes) using Swing.
Intro to GUIs (Graphical User Interfaces) Section 2.5Intro. to GUIs: a GUI Greeter Section 3.7Graphical/Internet Java: Einstein's Equation.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Object Oriented Programming Ders 11: Interfaces Mustafa Emre İlal
Java GUI CSCE 190 – Java Instructor: Joel Gompert Mon, July 26, 2004.
עקרונות תכנות מונחה עצמים תרגול 4 - GUI. Outline  Introduction to GUI  Swing  Basic components  Event handling.
CS Lecture 01 Frames and Components and events Lynda Thomas
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Chapter 9: Visual Programming Basics Object-Oriented Program Development Using Java: A Class-Centered Approach.
Session 27 Swing vs. AWT. AWT (Abstract Window ToolKit) It is a portable GUI library for stand-alone applications and/or applets. The Abstract Window.
GUIs in Java Swing, Events CS2110, SW Development Methods Readings: MSD, Chapter 12 Lab Exercise.
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
 2002 Prentice Hall, Inc. All rights reserved Introduction Graphical User Interface (GUI) –Gives program distinctive “look” and “feel” –Provides.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
– Advanced Programming P ROGRAMMING IN Lecture 21 Introduction to Swing.
1 Outline 1 Introduction 2 Overview of Swing Components 3 JLabel 4 Event Handling 5 TextFields 6 How Event Handling Works 7 JButton 8 JCheckBox and JRadioButton.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
GUI Clients 1 Enterprise Applications CE00465-M Clients with Graphical User Interfaces.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
MSc Workshop - © S. Kamin, U. ReddyLect 3 - GUI -1 Lecture 3 - Graphical User Interfaces r GUI toolkits in Java API r JFrame r GUI components.
SWING 101. IF YOU GET LOST - IMPORTANT LINKS  Swing articles:
CS Fall 2012, Lab 09 Haohan Zhu. Boston University Slideshow Title Goes Here CS Fall 2012, Lab /20/2015 GUI - Graphical User Interface.
Creating Windows. How can we use Java to create programs that use windows (GUI applications)? How can we use Java to create programs that use windows.
Lec.10 (Chapter 8 & 9) GUI Jiang (Jen) ZHENG June 27 th, 2005.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
Week 6: Basic GUI Programming Concepts in Java Example: JFrameDemo.java container : a screen window/applet window/panel that groups and arranges components.
CS 4244: Internet Programming User Interface Programming in Java 1.0.
Graphics in Java Dr. Andrew Wallace PhD BEng(hons) EurIng
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
Review_6 AWT, Swing, ActionListener, and Graphics.
CS Lecture 04 Mice Lynda Thomas
Java Swing, Events Readings: Just Java 2: Chap 19 & 21, or Eckel’s Thinking in Java: Chap 14 Slide credits to CMPUT 301, Department of Computing Science.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Lesson 28: More on the GUI button, frame and actions.
1 Lecture 8: User Interface Components with Swing.
Introduction to GUI Programming in Java: Frames, Simple Components, and Layouts.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
Java Swing and Events Chris North cs3724: HCI. Presentations nadine edwards, steve terhar Vote: UI Hall of Fame/Shame?
Introduction to Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
Java Swing What is swing? Swing is a ”Lightweight” GUI ToolKit for Java Different from AWT / SWT Toolkits for GUIs Few lines of code to produce GUI elements.
A Quick Java Swing Tutorial
Lecture 15 Basic GUI programming
Graphical User Interfaces
Welcome To java
Provision for GUIs in Java
A First Look at GUI Applications
Provision for GUIs in Java
Lecture 27 Creating Custom GUIs
CISC124 Quiz 2 grading underway.
Ellen Walker Hiram College
GUIS: Graphical User Interfaces
The AWT (versus Swing Components)
CISC124 Last Quiz next week. Topics listed in Tuesday’s lecture.
Steps to Creating a GUI Interface
Week 8 Swing NetBeans GUI Builder
Events, Event Handlers, and Threads
Lecture 4: Standard Java Graphics
Graphical User Interface
Presentation transcript:

CS Lecture 00 Swing overview and introduction Lynda Thomas

Overview Graphical User Interfaces –The actual graphics, and –Event driven programming (sits there until an event happens) AWT and Swing import java.awt.*; import javax.swing.*; AWT is ABSTRACT Window Toolkit AWT is still used for events etc. but for components….. Swing built on AWT.

AWT component classes are older. They communicate with ‘peer’ classes in the underlying OS to use its own components (different for different OSs) –Not all OSs have same components, May not behave exactly the same, so… –Lowest common denominator –Called ‘Heavyweight’ So, Swing was introduced built on AWT. Swing draws its own components, so less communication with OS. –Hence called ‘Lightweight’ –Also wider range of components, more consistency – start ‘J’ Future – JavaFX probably (Java FX Script has been discontinued) DO NOT MIX COMPONENTS don’t use AWT Panel instead of Swing JPanel!!!!! History

Links you will need! Java API Can follow links from the Swing classes to the … (try it with JOptionPane for instance) Swing Tutorial index.html

Using and extending classes You will be using classes like JButton and JTextField You will be extending classes like JFrame (a window) and JPanel (an area in a window)

Implementing interfaces You will be implementing interfaces like ActionListener (when a button is pressed) MouseListener (when the mouse is clicked) MouseMotionListener (when the mouse moves)

Let’s link to the API and look at a couple of Swing classes that you use or extend See, for instance JButton at Inheritance hierarchy package help

Now look at a Java awt.event interface You have just done interfaces List of methods to be implemented. Have a look at MouseMotionListener Note that it is italic package

Your classes will implement these interfaces, so These are the methods to be implemented by you. Read it as ‘in my program when the mouse is dragged do this …’

Lectures Today – run Bank and Life just to see what can do. May look at code for ASimple 1.Frames, Panels, Layout, Components 2.Menus 3.Drawing 4.Capturing Mouse information 5.Interactive graphics 6.Patterns - MVC Later… Swing & threads