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

Slides:



Advertisements
Similar presentations
Introduction to Swing Components Chapter 14. Part of the Java Foundation Classes (JFC) Provides a rich set of GUI components Used to create a Java program.
Advertisements

1 Graphical User Interfaces AWT and Swing packages Frames and Panels Components Nested Panels Images Reading for this Lecture: L&L, 3.9 – 3.11.
Graphical User Interfaces Java’s AWT and Swing APIs.
Graphical User Interfaces (Part IV)
Java Software Development Paradigm Lecture # 12. Basics of GUI.
1 Chapter 8 Objects and Classes Lecture 2 Prepared by Muhanad Alkhalisy.
CMSC 341 Building Java GUIs. 09/26/2007 CMSC 341 GUI 2 Why Java GUI Development? Course is about Data Structures, not GUIs. We are giving you the opportunity.
Introduction to Java Classes, events, GUI’s. Understand: How to use TextPad How to define a class or object How to create a GUI interface How event-driven.
Dale Roberts GUI Programming using Java - Mouse Events Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie July 20, 2005.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Lecture 15 Graphical User Interfaces (GUI’s). Objectives Provide a general set of concepts for GUI’s Layout manager GUI components GUI Design Guidelines.
Swinging Into Swing Leo S. Primero III. Understanding what Swing Is Swing is a package that lets you create applications that use a flashy Graphical User.
COMP 14 Introduction to Programming Miguel A. Otaduy June 7, 2004.
Applets, HTML and GUI’s Recitation – 04/11/2008 CS 180 Department of Computer Science, Purdue University.
Graphical User Interface Components: Part 1
GUI Programming in Java Tim McKenna GUI Programming Concepts l conventional programming: sequence of operations is determined by the program.
1 Class 8. 2 Chapter Objectives Use Swing components to build the GUI for a Swing program Implement an ActionListener to handle events Add interface components.
Graphic User Interfaces Part 1. Typical GUI Screen from Microsoft Word What GUI “components” can you see? –Menus? Buttons? Labels? What else? –Anything.
Java Programming Chapter 10 Graphical User Interfaces.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Dale Roberts Introduction to Java - Access Specifiers Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
CSE 219 Computer Science III Graphical User Interface.
Introduction to Swing Components Chapter 14.  Part of the Java Foundation Classes (JFC)  Provides a rich set of GUI components  Used to create a Java.
Java How to Program, 9/e © Copyright by Pearson Education, Inc. All Rights Reserved.
Omer Boyaci. Resources  
Dale Roberts Object Oriented Programming using Java - Enumerations Dale Roberts, Lecturer Computer Science, IUPUI Department.
Dale Roberts GUI Programming using Java - Event Handling Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts Program Control using Java - Selection Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Java Swing. Swing is a set of classes that provides more powerful and flexible components than are possible with the AWT. In addition to the familiar.
– Advanced Programming P ROGRAMMING IN Lecture 21 Introduction to Swing.
1 Graphical User Interfaces AWT and Swing packages Frames and Panels Components Nested Panels Images Reading for this Lecture: L&L, 3.9 – 3.11.
Dale Roberts GUI Programming using Java - GUI Components Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts Object Oriented Programming using Java - OOD to OOP: ATM Case Study Dale Roberts, Lecturer Computer Science, IUPUI
Object Oriented programming Instructor: Dr. Essam H. Houssein.
CSCI Swing1 The Abstract Windowing Toolkit Since Java was first released, its user interface facilities have been a significant weakness –The Abstract.
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.
Java Programming Applets. Topics Write an HTML document to host an applet Understand simple applets Use Labels with simple AWT applets Write a simple.
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.
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
Graphical User Interface Components: Part 1 Chapter 11.
Creating User Interfaces Chapter 13 CSCI CSCI 1302 – Creating User Interfaces2 Outline Introduction Common Features of Swing GUI Components Buttons.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 14 : Swing II King Fahd University of Petroleum & Minerals College of Computer Science.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 2 – Welcome Application Introduction to Graphical.
Basics of GUI Programming Chapter 11 and Chapter 22.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
Programming 2 LAB TA: Nouf Al-Harbi NoufNaief.net :::
Chapter 14: Introduction to Swing Components. Objectives Understand Swing components Use the JFrame class Use the JLabel class Use a layout manager Extend.
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.
Dale Roberts Object Oriented Programming using Java - Getters and Setters Dale Roberts, Lecturer Computer Science, IUPUI
Introduction to GUI Programming in Java: Frames, Simple Components, and Layouts.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
Java Programming Fifth Edition Chapter 13 Introduction to Swing Components.
Lecture 6 Object Oriented Programming Using Java By Rashid Ahmad Department of Computer Science University of Peshawar.
GUI Programming using Java - Event Handling
11 GUI Components: Part 1.
GUI Programming using Java - Key Events
11 GUI Components: Part 1.
Java Swing.
Graphical User Interface (pronounced "gooey")
Lecture 8 Object Oriented Programming Using Java
Lecture 27 Creating Custom GUIs
Graphical User Interface (GUI) Components: Part 1 Java How to Program, 9 th Edition Chapter 14.
MSIS670: Object-Oriented Software Engineering
IFS410: Advanced Analysis and Design
GUI Programming using Java - Mouse Events
Graphical User Interface
Presentation transcript:

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

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

Dale Roberts 3 Displaying Text and Images in a Window Class JFrame Most windows are an instance or subclass of this class Provides title bar Provides buttons to minimize, maximize and close the application

Dale Roberts 4 Labeling GUI Components Label Text instructions or information stating the purpose of each component Created with class JLabel

Dale Roberts 5 Specifying the Layout Laying out containers Determines where components are placed in the container Done in Java with layout managers One of which is class FlowLayout Set with the setLayout method of class JFrame

Dale Roberts 6Outline LabelFr ame.ja va (1 of 2)

Dale Roberts 7Outline LabelFr ame.ja va (2 of 2)

Dale Roberts 8 Creating and Attaching label1 Method setToolTipText of class JComponent Specifies the tool tip Method add of class Container Adds a component to a container

Dale Roberts 9 Creating and Attaching label2 Interface Icon Can be added to a JLabel with the setIcon method Implemented by class ImageIcon Interface SwingConstants Declares a set of common integer constants such as those used to set the alignment of components Can be used with methods setHorizontalAlignment and setVerticalAlignment

Dale Roberts 10 Creating and Attaching label3 Other JLabel methods getText and setText For setting and retrieving the text of a label getIcon and setIcon For setting and retrieving the icon displayed in the label getHorizontalTextPosition and setHorizontalTextPosition For setting and retrieving the horizontal position of the text displayed in the label

Dale Roberts 11 Fig | Some basic GUI components.

Dale Roberts 12Outline LabelTest.j ava

Dale Roberts 13 Creating and Displaying a LabelFrame Window Other JFrame methods setDefaultCloseOperation Dictates how the application reacts when the user clicks the close button setSize Specifies the width and height of the window setVisible Determines whether the window is displayed ( true ) or not ( false )

Dale Roberts Acknowledgements Deitel, Java How to Program