5-Jan-16 R Ramesh Swing. 5-Jan-16 R Ramesh An Introduction to Java Foundation Classes (JFC) A suite of libraries to assist programmers create enterprise.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

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.
User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Introduction to JFC Swing Written by Adam Carmi. Agenda About JFC and Swing Pluggable Look and Feel Swing Components Borders Layout Management Events.
 What are the basic GUI components we’ve learned so far? › JFrame › JPanel › JButton › JLabel › JTextArea › JTextField › JCheckBox › JRadioButton › Paint.
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.
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.
THE SWING UI TOOLKIT Mostly from “The Swing Connection”The Swing Connection.
Creating a GUI with Swing. Introduction Very useful link: Swing – is a part of JFC (Java Foundation.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
1 L47 Advanced GUI Component (2). 2 OBJECTIVES  To create and manipulate pop-up menus and windows.  To change the look-and-feel of a GUI, using Swing's.
1 L46 Advanced GUI Component (1). 2 OBJECTIVES  To create and manipulate sliders, and menus,
Advanced Java Class GUI, part 2. JComponent methods addXXXListener(XXXListener) repaint() – [optional arguments: delay and coordinates of sub-area to.
GUI Programming in Java Tim McKenna GUI Programming Concepts l conventional programming: sequence of operations is determined by the program.
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.
CS3 - AWT/Swing1 The Abstract Windowing Toolkit Since Java was first released, its user interface facilities have been a significant weakness –The Abstract.
GUI Programming in Java
W14 - Building World-Class UIs with JFC - Ted Faison1 Building World-Class User Interfaces with Java Foundation Classes Ted Faison Faison Computing Inc.
Software Construction Lecture 10 Frameworks
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
Java Swing, Events and MVC Optional Readings: Eckel’s Thinking in Java: Chap 14 (
CS377A: A Programming Approach to HCI Jan Borchers Spring Swing Refresher David Merrill 5/14/2002
Object Oriented Programming Ders 11: Interfaces Mustafa Emre İlal
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.
Graphical User Interface Components Chapter What You Will Learn Text Areas Text Areas Sliders Sliders Menus Menus –With frames –Pop up menus Look.
CSE 219 Patterns in Programming More Design Patterns.
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.
– 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.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Java Programming: Advanced Topics 1 Components and Facilities for Rich Graphical User Interfaces Chapter 7.
SWING 101. IF YOU GET LOST - IMPORTANT LINKS  Swing articles:
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 35 MVC and Swing MVC.
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.
Lec.10 (Chapter 8 & 9) GUI Jiang (Jen) ZHENG June 27 th, 2005.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 15 Creating User.
CHAPTER:07 JAVA IDE PROGRAMMING-II Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Swing / Session1 / 1 of 30 Module Introduction Distributed Computing in Java.
Swing Components. Introduction Swing – A set of GUI classes – Part of the Java's standard library –Much better than the previous library: AWT Abstract.
Swinging in Your Java Playground. Background Swing is a part of the Java Foundation Classes (JFC). The JFC is made up of features intended to give a programmer.
Swing - 2 Session 13. Swing - 2 / 2 of 38 Objectives (1) Discuss trees and tables Discuss progress bars Discuss MVC architecture Describe menus.
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
The Swing GUI Components Chapter 29 An enhanced alternative to AWT The PC does not need an appletviewer or browser Swing overcomes some AWT drawbacks.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
Java Programming, Second Edition Chapter Thirteen Understanding Swing Components.
Chapter 14: Introduction to Swing Components. Objectives Understand Swing components Use the JFrame class Use the JLabel class Use a layout manager Extend.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 15 : Swing III King Fahd University of Petroleum & Minerals College of Computer.
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.
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.
Java Programming Fifth Edition Chapter 13 Introduction to Swing Components.
Introduction to Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
Module 13: Swing API Object Oriented Programming(Java)
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
Advanced User Interfaces
University of Central Florida COP 3330 Object Oriented Programming
Event Driven Programming and Graphical User Interface
Presentation transcript:

5-Jan-16 R Ramesh Swing

5-Jan-16 R Ramesh An Introduction to Java Foundation Classes (JFC) A suite of libraries to assist programmers create enterprise applications. Extends the original Abstract Window Toolkit (AWT) by adding a comprehensive set of graphical user interface class libraries

5-Jan-16 R Ramesh The Five API’s of JFC Abstract window toolkit (AWT) Swing Accessibility Java 2D Drag and Drop

5-Jan-16 R Ramesh AWT Basic GUI toolkit New event model Downward compatibility for java versions less than 1.1

5-Jan-16 R Ramesh Swing Built on top of the core 1.1 and 1.2 AWT libraries Has twice the number of components as AWT Cleaner design throughout Depends on event handling mechanism of AWT 1.1

5-Jan-16 R Ramesh Accessibility Assistance to users who have trouble with traditional user interfaces Used in conjunction with devices such as audible text readers or braille keyboards

5-Jan-16 R Ramesh Java 2D Classes for implementing various painting styles, complex shapes, fonts and colors Based on APIs that were licensed from IBM’s Taligent division Not a part of Swing

5-Jan-16 R Ramesh Drag and Drop Moving objects in and out of window or frame with predictable results Can be used to transfer information between Java applications and native applications Not a part of Swing

5-Jan-16 R Ramesh The Five API’s of JFC

5-Jan-16 R Ramesh Why Swing and Why Not AWT? AWT provided minimum functionality necessary to create a windowing application Swing is not a replacement for AWT but built on top of core AWT libraries

5-Jan-16 R Ramesh Disadvantages of AWT Uses platform’s native components Minimal number of components Timing and sequence problems between platforms

5-Jan-16 R Ramesh Why Swing? Pluggable look-and-feels Lightweight components Other features Wide variety of components Support for rendering custom Swing components Support for replacing their insets with arbitrary concentric borders

5-Jan-16 R Ramesh Model View Controller (MVC) Architecture Design Pattern introduced as a part of Smalltalk-80 version of Smalltalk programming language Build systems that made use of multiple, synchronized presentation of same data

5-Jan-16 R Ramesh MVC may be used in  A graph package that contains different graphical view of same data  A CAD system, in which portions of design can be viewed at different magnifications, in different windows and at different scales

5-Jan-16 R Ramesh

5-Jan-16 R Ramesh

5-Jan-16 R Ramesh Model Represents state and low-level behavior of the component Manages state and conducts transformations on that state Has no specific knowledge of either its controllers or its views

5-Jan-16 R Ramesh View Manages visual display of the state represented by model A model can have more than one view Swing set has one view associated with one model

5-Jan-16 R Ramesh Controller Manages user interaction with the model Has mechanism by which changes are made to the state of the model

5-Jan-16 R Ramesh Benefits of MVC Clearly defined separation between components of a program Problems in each domain can be solved independently Binding between the model and the view is dynamic

5-Jan-16 R Ramesh MVC in Swing Components

5-Jan-16 R Ramesh The Model The methods under model can be grouped as Query internal state Manipulate internal state Add and remove event listeners Fire events

5-Jan-16 R Ramesh The View and Controller Responsible for creating visual representation and handling user input Methods are Paint Return geometric information Handle AWT events

5-Jan-16 R Ramesh JComponents and Subclasses Abstract class extended by all Swing components Contains properties such as, Background/foreground Enable/Disable Visibility

5-Jan-16 R Ramesh java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent JComponent’s Ancestry

5-Jan-16 R Ramesh Top Level Components JApplet JDialog JFrame JWindow derived from their AWT version

5-Jan-16 R Ramesh Components Under JComponent JComboBox JLabel JList JMenuBar JPanel JPopupMenu JScrollPane JTable JTree JInternalFrame JOptionPane JProgressBar JRootPane JSeparator JSlider JSplitPane JTabbedPane JToolBar JToolTip JViewport JColorChooser JFileChooser JLayeredPane JTextComponent JTextArea JTextField JPasswordField JEditorPane JTextPane JDesktopPane

5-Jan-16 R Ramesh Components Under JComponent Contd.. JRadioButton JToggleButton JButton JMenuItem JCheckBox Abstract Button JMenu JRadioButtonMenuItemJCheckButtonMenuItem

5-Jan-16 R Ramesh What JComponent Provides Invalidating and repainting Position, size and alignment Adding Borders Tooltips Double Buffering Focus and Focus Cycle

5-Jan-16 R Ramesh JFrame Standard window Retains the look and feel of host OS Acts as the main window to an application

5-Jan-16 R Ramesh JWindow Floats anywhere on the screen Has no frame around it Typically used for popup menus To display Splash screens

5-Jan-16 R Ramesh JDialog Floats anywhere on the screen Can be modal or non-modal Used to display messages The border and title bar are defined by the OS

5-Jan-16 R Ramesh JMenu Attached to a menu bar (JMenuBar) or another JMenu Items are added using JMenuItem Items can be a JMenuItem and/or JCheckBoxMenuItem and/or JRadioButtonMenuItem

5-Jan-16 R Ramesh JPanel A container to add components or to draw. A non-abstract version of JComponent Common use is to group components

5-Jan-16 R Ramesh JScrollPane Helps to scroll around panels Automatically adjusts itself

5-Jan-16 R Ramesh JSplitPane A container which can hold two components Can be split horizontally or vertically

5-Jan-16 R Ramesh JTabbedPane To display more components in one screen Components are grouped into categories Each tab holds a category of components

5-Jan-16 R Ramesh ImageIcon Load small Images Used when needed Used on Buttons, Check boxes, Radio buttons etc.

5-Jan-16 R Ramesh JToolBar A series of icon buttons Used as shortcuts to tasks A tool tip is associated with each button A tool bar can be in a separate window

5-Jan-16 R Ramesh JSlider and JProgressBar A JSlider has minimum, maximum and a current value Units on a JSlider can be displayed using tick marks and labels A JProgressBar is used to display the progress of a task

5-Jan-16 R Ramesh JTable Helps to create spreadsheet like controls that have rows and columns Editable cells Cell renderers can be used to add components like checkbox into a cell

5-Jan-16 R Ramesh JTree To display data in a hierarchical way One root node from which all nodes descend Nodes can be collapsed/expanded

5-Jan-16 R Ramesh Summary JFC Between Swing and AWT MVC Architecture JComponent and its sub classes