SE-1020 Dr. Mark L. Hornick 1 Graphical User Interfaces.

Slides:



Advertisements
Similar presentations
Unit 3 Graphical User Interface (GUI) Dr. Magdi AMER.
Advertisements

Building Applications Dialogs Passing data between windows Validating Input using FocusListeners.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Using JOptionPanes for graphical communication with our programs. Pages Horstmann 139.
Lecture 15 Graphical User Interfaces (GUI’s). Objectives Provide a general set of concepts for GUI’s Layout manager GUI components GUI Design Guidelines.
Creating a GUI with Swing. Introduction Very useful link: Swing – is a part of JFC (Java Foundation.
CPSC150 Week 12 Graphical User Interfaces Chapter 11.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Programming with Java standard classes. Java API Application Programming Interface Provides hundreds of standard classes that can be incorporated into.
Relational Operators Control structures Decisions using “if” statements  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course.
CPSC150 Java Lynn Lambert Create your own GUI From lab3 From lab3 Build an empty Window with 4 button Build an empty Window with 4 button Each button should.
CC1007NI: Further Programming Week 5 Dhruba Sen Module Leader (Islington College)
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
GUI Basics: Introduction. Creating GUI Objects // Create a button with text OK JButton jbtOK = new JButton("OK"); // Create a label with text "Enter your.
Programming With Java ICS201 University Of Ha’il1 Chapter 17 Graphical User Interfaces Swing I.
JLabel, JTextField, JButton and JOptionPane
Intro to GUIs (Graphical User Interfaces) Section 2.5Intro. to GUIs: a GUI Greeter Section 3.7Graphical/Internet Java: Einstein's Equation.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
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.
Java Programming, Second Edition Chapter Five Input and Selection.
Intro to Java Java Applications Swing Class Graphics.
Objectives of This Session
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
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.
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.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
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.
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.
 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.
Option Panes CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 – Graphical User Interfaces Java Foundations: Introduction to Programming.
Graphical User Interfaces. Graphical input and output with JOptionPane.
GUI Graphical User Interface Each onscreen component and window is an object Object interaction makes communication and scoping challenging Event-driven.
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
SD2054 Software Development. By the end of this lecture you should be able to: Advanced Graphics Programming create pull down menus create combo boxes.
CIS Intro to JAVA Lecture Notes Set 8 9-June-05.
Basics of GUI Programming Chapter 11 and Chapter 22.
Graphical User Interfaces Tonga Institute of Higher Education.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
JOptionPane Class JOptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something. While the JOptionPane.
 2005 Pearson Education, Inc. All rights reserved. 1 Introduction to Classes and Objects.
Creating and Using Dialogs ● A dialog is a box that pops up and prompts the user for a value or informs them of something ● One way: directly create objects.
1 IM103 week 10 Enhancing the user interface By the end of lecture you should be able to:  distinguish between heavyweight and lightweight components;
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Casting, Wrapper Classes, Static Methods, JOptionPane Class.
Applets. 9/04/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L12: Applets Slide 2 Applets Usually.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
Introduction to GUI in 1 Graphical User Interface Nouf Almunyif.
SE-1020 Dr. Mark L. Hornick 1 Creating Graphical User Interfaces.
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit 6 Graphical user interfaces 1.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 7 ( Book Chapter 14) GUI and Event-Driven Programming.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 7 Event-Driven Programming and Basic GUI Objects.
A Quick Java Swing Tutorial
Lecture 15 Basic GUI programming
Section 64 – Manipulating Data Using Methods – Java Swing
Message, Input, Confirm, and Specialized Dialogs
JOptionPane Dialogs javax.swing.JOptionPane is a class for creating dialog boxes. Has both static methods and instance methods for dialogs. Easy to create.
CS18000: Problem Solving and Object-Oriented Programming
Message, Input, and Confirm Dialogs
Week 8 Swing NetBeans GUI Builder
Advanced Programming in Java
CS431 ws99 Half Text Half Graphics
Graphical User Interface
TA: Nouf Al-Harbi NoufNaief.net :::
Presentation transcript:

SE-1020 Dr. Mark L. Hornick 1 Graphical User Interfaces

SE-1020 Dr. Mark L. Hornick 2 You’ve already done some Java GUI programming JOptionPane - a multi-purpose class whose behavior varies based on which static method you invoke showMessageDialog showInputDialog showConfirmDialog showOptionDialog

SE-1020 Dr. Mark L. Hornick 3 JOptionPane. showMessageDialog() provides a simple way to display a message to the user: JOptionPane.showMessageDialog(null, “I Love Java”);

SE-1020 Dr. Mark L. Hornick 4 JOptionPane. showInputDialog() provides a way to prompt the user for some text input: String text = JOptionPane.showInputDialog(null, "Enter some text:", "Input dialog", JOptionPane.QUESTION_MESSAGE);

SE-1020 Dr. Mark L. Hornick 5 JOptionPane.showConfirmDialog() provides a way to present a variety of standard button choices to the user: response = JOptionPane.showConfirmDialog( null, "Run Again?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );

SE-1020 Dr. Mark L. Hornick 6 JOptionPane.showOptionDialog() provides A way to customize the options presented to the user beyond the standard choices: Object[] options = { “Bye" }; JOptionPane.showOptionDialog(null, "Game over; you're broke.", "Please come again", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);

SE-1020 Dr. Mark L. Hornick 7 There are a lot more GUI classes than just JOptionPane These are in two different packages AWT (Abstract Window Toolkit) classes are implemented by using the native GUI objects AWT classes for Windows are written differently than AWT classes written for the MAC A GUI application written on for a MAC will look different than one written for a Windows-based PC Swing classes are fully implemented in Java, and behave the same on different operating systems. They provide greater compatibility across different operating systems (JOptionPane is part of javax.swing)

SE-1020 Dr. Mark L. Hornick 8 Swing classes support many more functionalities not supported by AWT counterparts Rules for usage: Do not mix the counterparts (e.g. AWT buttons and Swing buttons) in the same program because of their differences in implementation. UNLESS there is no Swing counterpart to AWT (e.g. AWT Graphics) then it is OK to use AWT.

SE-1020 Dr. Mark L. Hornick 9 JTextField JLabel JFrameJButton The JFrame class is the fundamental “window” class It contains rudimentary functionalities to support features found in any frame window. A JFrame object serves as the “host” for containing other components,