Provision for GUIs in Java

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

14 Copyright © 2005, Oracle. All rights reserved. User Interface Design: Swing Basics Planning the Application Layout.
Graphical User Interfaces
Java Software Development Paradigm Lecture # 12. Basics of GUI.
CS18000: Problem Solving and Object-Oriented Programming.
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.
Java Swing Toolkit Graphics The key to effectively using graphics in Java is understanding: –the basic components of the graphics library –the patterns.
Understanding SWING Architecture CS 4170 UI Design Hrvoje Benko Oct. 9, 2001.
Graphical User Interfaces (GUIs) GUI: An application that uses graphical objects to interact with users GUI applications consist of: –Events: A user or.
Creating a GUI with Swing. Introduction Very useful link: Swing – is a part of JFC (Java Foundation.
Unit 111 Java GUI Components and Events  Learning Outcomes oDistinguish between GUI components and containers. oIdentify and distinguish top-level containers.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
CPSC150 Week 12 Graphical User Interfaces Chapter 11.
Contructing GUI’s in Java Implemented in the Swing API Imported into your programs by: import javax.swing.*; Most Swing programs also need the AWT packages.
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
Java Programming Chapter 10 Graphical User Interfaces.
1 Event Driven Programming wirh Graphical User Interfaces (GUIs) A Crash Course © Rick Mercer.
Java Swing, Events and MVC Optional Readings: Eckel’s Thinking in Java: Chap 14 (
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Object Oriented Programming Ders 11: Interfaces Mustafa Emre İlal
עקרונות תכנות מונחה עצמים תרגול 4 - GUI. Outline  Introduction to GUI  Swing  Basic components  Event handling.
3461A Readings from the Swing Tutorial. 3461A Overview  The follow is the Table of Contents from the trail “Creating a GUI with JFC/Swing” in the “The.
Java Programming: Advanced Topics 1 Common Elements of Graphical User Interfaces Chapter 6.
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.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
CS Lecture 00 Swing overview and introduction Lynda Thomas
SWING 101. IF YOU GET LOST - IMPORTANT LINKS  Swing articles:
1 Java Swing - Lecture 2 Components and Containment Boriana Koleva
CSCI Swing1 The Abstract Windowing Toolkit Since Java was first released, its user interface facilities have been a significant weakness –The Abstract.
CS Fall 2012, Lab 09 Haohan Zhu. Boston University Slideshow Title Goes Here CS Fall 2012, Lab /20/2015 GUI - Graphical User Interface.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
GUI Basics. What is GUI? A graphical user interface (GUI) is a type of user interface item that allows people to interact with programs in more ways than.
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.
CS1054: Lecture 21 - Graphical User Interface. Graphical User Interfaces vs. Text User Interface.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
CS 4244: Internet Programming User Interface Programming in Java 1.0.
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
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.
Introduction to GUI Programming in Java: Frames, Simple Components, and Layouts.
Introduction to Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
Introduction to Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 7 Event-Driven Programming and Basic GUI Objects.
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
Graphical User Interfaces
Welcome To java
A First Look at GUI Applications
University of Central Florida COP 3330 Object Oriented Programming
Provision for GUIs in Java
Lecture 8 Object Oriented Programming Using Java
Lecture 27 Creating Custom GUIs
Event Driven Programming and Graphical User Interface
GUIS: Graphical User Interfaces
תכנות מכוון עצמים בשפת JAVA
Steps to Creating a GUI Interface
Introduction to Graphical Interfaces in Java: AWT and Swing
Lecture 4: Standard Java Graphics
Graphical User Interface
Presentation transcript:

Provision for GUIs in Java CSC 202

Evolution of GUI Capabilities in Java

Java 1.0 Abstract Window Toolkit (AWT) Called “Abominable” or “Awful Window Toolkit”. Done in 30 days. Last minute add-on. Java 1.1 Significantly improved, But GUI not finished.

Java 2 - Swing Much improved from AWT. Part of Java Foundation Classes (JFC). Very easy to add: Accelerators Tool Tips Graphics Pluggable look and feel.

AWT vs Swing AWT approach Swing approach Implement common elements of various operating environments. Swing approach Departure from AWT effort. Swing only needs to know how to write a pixel on a screen in a particular environment. AWT classes are extended in Swing. Example: AWT Button became Swing JButton.

The Operating System GUI Interface

Multitask operating system (Windows, UNIX, Linux, etc.) When the o.s. detects an event such as a mouse click, It determines what the event was; It determines in which application window it occurred.

Operating System Interface The operating system Passes event info as a message to the appropriate application, and Permits the app to take action. May interrupt the subsequent action if another event is detected.

Containment Hierarchy - 1 One and only one top-level container. May contain any number of intermediate-level and atomic components. Swing: almost always a JFrame. Automatically provides a root pane. AWT: the top-level container was referred to as “heavyweight” component. “Weighed down” with responsibility of interacting with the O/S. “Lightweight” components are not tied to the O/S.

Containment Hierarchy - 2 Next important level: “content pane.” Internal component of the top-level container. All visible components other than menu bar go here. (See h/o, Bronson, 571).

Containment Hierarchy - 3 Lower levels (“lightweight components”): Atomic components. Intermediate components.

Layout Managers Each top-level and intermediate container has a default layout manager. JFrame, JDialog, and JPanel – BorderLayout JWindow – FlowLayout Defines how components are sized and positioned within the container's content pane. (See handout - Bronson, 605.)

Creating a Swing-Based Window - Two Approaches: Construct a GUI object using Swing components from within a main() method without first creating a separate GUI class. Sometimes used to introduce Swing components and to create extremely simple GUIs. This is how our first example was done. (See FirstGUI.java) Construct the GUI as a separate class using Swing components. (See FirstWindow.java) In general this is preferred (adheres more closely to accepted OO practice).