Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Dale Roberts GUI Programming using Java - Mouse Events Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Unit 091 Introduction to GUI Programming Introduction to User Interfaces Introduction to GUI Programming GUI Design Issues GUI Programming Issues Java.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
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.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Graphic User Interfaces Part 1. Typical GUI Screen from Microsoft Word What GUI “components” can you see? –Menus? Buttons? Labels? What else? –Anything.
PROGRAMMING REVIEW Lab 2 EECS 448 Dr Fengjun Li and Meenakshi Mishra.
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
Java Programming Chapter 10 Graphical User Interfaces.
Exepction Handling  Exception handling enables you to create applications that can resolve (or handle) exceptions.  In many cases, handling an exception.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
Intro to GUIs (Graphical User Interfaces) Section 2.5Intro. to GUIs: a GUI Greeter Section 3.7Graphical/Internet Java: Einstein's Equation.
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
Lab 6: Shapes & Picture Extended Ellipse & Rectangle Classes Stand-Alone GUI Applications.
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 How to Program, 9/e © Copyright by Pearson Education, Inc. All Rights Reserved.
Dale Roberts GUI Programming using Java - Event Handling Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
 2002 Prentice Hall, Inc. All rights reserved Introduction Graphical User Interface (GUI) –Gives program distinctive “look” and “feel” –Provides.
– 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.
GUI Clients 1 Enterprise Applications CE00465-M Clients with Graphical User Interfaces.
1 Java Programming 1 Introduction to Basic GUI Lesson 4.
CS Lecture 00 Swing overview and introduction Lynda Thomas
Timer class and inner classes. Processing timer events Timer is part of javax.swing helps manage activity over time Use it to set up a timer to generate.
Applets Yong Choi School of Business CSU, Bakersfield.
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.
 GUI – Graphic User Interface  Up to now in the programs we have written all output has been sent to the standard output device i.e.: the DOS console.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 – Graphical User Interfaces Java Foundations: Introduction to Programming.
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
CIS Intro to JAVA Lecture Notes Set 8 9-June-05.
Graphical User Interface Components: Part 1 Chapter 11.
Outline Creating Objects The String Class The Random and Math Classes Formatting Output Enumerated Types Wrapper Classes Components and Containers Images.
Basics of GUI Programming Chapter 11 and Chapter 22.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
SE-1020 Dr. Mark L. Hornick 1 Graphical User Interfaces.
Lecture # 6 Graphical User Interface(GUI). Introduction A graphical user interface (GUI) presents a user- friendly mechanism for interacting with an application.
Dale Roberts Introduction to Java - Input, Program Control and Instantiation Dale Roberts, Lecturer Computer Science, IUPUI
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Casting, Wrapper Classes, Static Methods, JOptionPane Class.
1 Lecture 8: User Interface Components with Swing.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
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 GUI in 1 Graphical User Interface Nouf Almunyif.
Introduction to Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
Dale Roberts GUI Programming using Java - Windowing Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 7 ( Book Chapter 14) GUI and Event-Driven Programming.
Lecture 6 Object Oriented Programming Using Java By Rashid Ahmad Department of Computer Science University of Peshawar.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 7 Event-Driven Programming and Basic GUI Objects.
A Quick Java Swing Tutorial
GUI Programming using Java - Event Handling
Lecture 15 Basic GUI programming
Provision for GUIs in Java
GUI Programming using Java - Key Events
A First Look at GUI Applications
Provision for GUIs in Java
Lecture 8 Object Oriented Programming Using Java
Graphical User Interface (GUI) Components: Part 1 Java How to Program, 9 th Edition Chapter 14.
Introduction to GUI in Graphical User Interface Nouf Almunyif.
Advanced Programming in Java
Graphical User Interface
TA: Nouf Al-Harbi NoufNaief.net :::
Presentation transcript:

Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School of Science, IUPUI

Dale Roberts Graphical user interface (GUI) Presents a user-friendly mechanism for interacting with an application Often contains title bar, menu bar containing menus, buttons and combo boxes Built from GUI components

Dale Roberts Graphical Components buttonmenustitle barmenu barcombo box scroll bars

Dale Roberts 4 Simple GUI-Based Input/Output with JOptionPane Dialog boxes Used by applications to interact with the user Provided by Java’s JOptionPane class Contains input dialogs and message dialogs

Dale Roberts 5Outline Addition.java (1 of 2) Show input dialog to receive first integer Show input dialog to receive second integer Show message dialog to output sum to user

Dale Roberts 6Outline Addition.java (2 of 2) Input dialog displayed by lines 10–11 Input dialog displayed by lines 12 – 13 Message dialog displayed by lines 22 – 23 Text field in which the user types a value Prompt to the user When the user clicks OK, showInputDialog returns to the program the 100 typed by the user as a String. The program must convert the String to an int title bar When the user clicks OK, the message dialog is dismissed (removed from the screen)

Dale Roberts 7 Fig | JOptionPane static constants for message dialogs.

Dale Roberts Overview of Swing Components Swing GUI components Declared in package javax.swing Most are pure Java components Part of the Java Foundation Classes (JFC)

Dale Roberts

10 Swing vs. AWT Abstract Window Toolkit (AWT) Precursor to Swing Declared in package java.awt Does not provide consistent, cross-platform look-and-feel

Dale Roberts 11 Portability Tip 11.1 Swing components are implemented in Java, so they are more portable and flexible than the original Java GUI components from package java.awt, which were based on the GUI components of the underlying platform. For this reason, Swing GUI components are generally preferred.

Dale Roberts 12 Lightweight vs. Heavyweight GUI Components Lightweight components Not tied directly to GUI components supported by underlying platform Heavyweight components Tied directly to the local platform AWT components Some Swing components

Dale Roberts 13 Superclasses of Swing’s Lightweight GUI Components Class Component (package java.awt ) Subclass of Object Declares many behaviors and attributes common to GUI components Class Container (package java.awt ) Subclass of Component Organizes Component s Class JComponent (package javax.swing ) Subclass of Container Superclass of all lightweight Swing components

Dale Roberts

15 Superclasses of Swing’s Lightweight GUI Components Common lightweight component features Pluggable look-and-feel to customize the appearance of components Shortcut keys (called mnemonics) Common event-handling capabilities Brief description of component’s purpose (called tool tips) Support for localization

Dale Roberts Acknowledgements Deitel, Java How to Program