User Interface Components. Layout Placement of UI components in a window – Size & Position Each component occupies a rectangular region in the window.

Slides:



Advertisements
Similar presentations
G5BUID - Java Swing Laying out components Manage realized components Determine size and position Each container has a layout manager (usually)
Advertisements

Graphic User Interfaces Layout Managers Event Handling.
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.
Corresponds with Chapter 12
Fall 2007CS 225 Graphical User Interfaces Event Handling Appendix C.
Java Swing Recitation – 11/(20,21)/2008 CS 180 Department of Computer Science, Purdue University.
Graphical User Interfaces Allow for interaction with –Buttons –Menus –Text Fields Two Java Libraries to assist in GUI Programming –AWT –Swing.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
CPSC150 JavaLynn Lambert CPSC150 Week 12 InheritanceInterfaces.
10.1 AWT The AWT classes Users today expect a Graphical User Interface (GUI) Improves application usability Difficult to implement cross-platform.
Applets, AWTS CompSci 230 Software Construction.
MSc Workshop - © S. Kamin, U.Reddy Lect 5 – GUI Prog - 1 Lecture 5 – GUI Programming r Inner classes  this and super r Layout r Reading: m.
CIS 068 Welcome to CIS 083 ! Introduction to GUIs: JAVA Swing.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
CSE 219 Computer Science III Graphical User Interface.
Java GUIs and Graphics CNS Outline  Introduction  Events  Components  Layout managers  Drawing  Introduction  Events  Components  Layout.
Rina System development with Java Instructors: Rina Zviel-Girshin Lecture 12.
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.
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 Programming: Advanced Topics 1 Common Elements of Graphical User Interfaces Chapter 6.
Introducing the Eclipse Visual Editor David Gallardo.
Session 11 Border Layout, using Panels, Introduction to PinBallGame.
Session 10 CannonGame and Event-driven Programming.
Field Trip #19 Animations with Java By Keith Lynn.
 2002 Prentice Hall, Inc. All rights reserved Introduction Graphical User Interface (GUI) –Gives program distinctive “look” and “feel” –Provides.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
Laying Out Components Interior Design for GUIs. Nov 042 What is Widget Layout? Positioning widgets in their container (typically a JPanel or a JFrame’s.
Layout Managers Arranges and lays out the GUI components on a container.
Layout Manager Summary
Object Oriented Programming Engr. M. Fahad Khan Lecturer, Software Engineering Department University of Engineering & Technology, Taxila.
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.
CS Fall 2012, Lab 09 Haohan Zhu. Boston University Slideshow Title Goes Here CS Fall 2012, Lab /20/2015 GUI - Graphical User Interface.
1 / 67 COP 3503 FALL 2012 SHAYAN JAVED LECTURE 14 Programming Fundamentals using Java 1.
CS324e - Elements of Graphics and Visualization Java GUIs - Event Handling.
University of Limerick1 Software Architecture Java Layout Managers.
Lec.10 (Chapter 8 & 9) GUI Jiang (Jen) ZHENG June 27 th, 2005.
3461 Laying Out Components Interior Design for GUIs.
The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: a rich set of user interface components; a.
SEEM3460 Tutorial GUI in Java. Some Basic GUI Terms Component (Control in some languages) the basic GUI unit something visible something that user can.
Field Trip #23 Hangman By Keith Lynn. JApplet A JApplet is a top-level container An applet is a small Java program that is executed by another program.
Computer Science 209 GUIs Model/View/Controller Layouts.
Java layout managers. import java.awt.*; import java.awt.event.*; import javax.swing.*; class ButtonPanel extends JPanel implements ActionListener { public.
Ajmer Singh PGT(IP) JAVA IDE Programming - I. Ajmer Singh PGT(IP) GUI (Graphical User Interface) It is an interface that uses a graphic entities along.
Graphical User Interfaces Tonga Institute of Higher Education.
AWT Layout Managers (Chapter 10) Java Certification Study Group January 21, 1999 Mark Roth.
Test Postmortem Dennis Burford
Java Swing - Lecture 3 Layout Management
1 CSE 331 Composite Layouts; Decorators slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Graphical User Interface (GUI)
Event Handler Methods Text field Object Responder JAVA AWT Environment: Messages are sent between JAVA Objects Screen Event Notification Press Button.
Developing GUIs With the Eclipse Visual Editor, Swing/AWT Edition David Gallardo.
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.
CSC 205 Programming II Lecture 7 AWT – Event Handling & Layout.
Introduction to GUI Programming in Java: Frames, Simple Components, and Layouts.
Assignment #3 (Due, March 24, 2003) 1. Write an applet that plots f(x) = sin(x). Let x range from - 2*Math.PI to 2*Math.PI. Scale the plot so it fits within.
GUI Programming In Java Sagun Dhakhwa BIM, HSM. GUI Appllications Event Driven OOP Uses objects of Classes like in any other Java programming.
Introduction to Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
A Quick Java Swing Tutorial
Swing JComponents.
University of Central Florida COP 3330 Object Oriented Programming
Graphical User Interface (pronounced "gooey")
Containers and Components
תכנות מכוון עצמים בשפת JAVA
Creating Graphical User Interfaces
Panels & Layout Managers
Steps to Creating a GUI Interface
Border Layout, using Panels, Introduction to PinBallGame
GUI Layouts By: Leonard & Saif.
Layout Organization and Management
Presentation transcript:

User Interface Components

Layout Placement of UI components in a window – Size & Position Each component occupies a rectangular region in the window Components are told where and how big they are Each component has a – Preferred size – Minimum size – Maximum size

Layout Ideally, each component will be assigned its preferred size To accommodate the current window size, a component may get more or less space than it prefers Window resize behavior – When the user resizes a window, the sizes and positions of components in the window must be adjusted to accommodate the new size

Panels The area of a frame window can be divided into rectangular regions called “panels” – Implemented by the JPanel class Each panel contains sub-components – A panel is a “container” component, because it contains other components Component Tree – Frame window at the root – Panels for the interior nodes – Simple components (e.g., buttons, text fields, etc.) at the leaves Each panel’s components are lain out separately

Layout Managers There are different algorithms for laying out components in a panel Each panel has a “layout manager” object that is responsible for deciding the sizes and positions of the panel’s components Java provides several LayoutManager classes that implement different layout algorithms – BorderLayout, BoxLayout, CardLayout, FlowLayout, GridLayout, GridBagLayout, GroupLayout, SpringLayout, …

Simple Layout FlowLayout – Example: FlowTestFlowTest BorderLayout – Example: BorderTestBorderTest GridLayout – Example: GridTestGridTest

Built-in Components Guide to Swing Components Component Events – User actions generate events – Listeners respond to events – Example: Font SelectorFont Selector ActionListener, ChangeListener – Listeners Supported by Swing Components Listeners Supported by Swing Components

Design Exercise: Simple Web Browser Web Browser Web Browser (Refactored)