User Interfaces II GUI – Awt, Swing, Web

Slides:



Advertisements
Similar presentations
1 Graphical User Interface (GUI) Applications Abstract Windowing Toolkit (AWT) Events Handling Applets.
Advertisements

Chapter 16 GUI Programming Basics GUI Overview Event-Driven Programming Basics GUI Classes and Packages A Simple Window Program JFrame Class Java Components.
A Programmer's Introduction to Java - from a S/370 user (c) IDMS/SQL News
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.
Unit 121 A layout manager is an object that determines the manner in which components are arranged in a container. Each layout manager implements one of.
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.
GUI. Swing Programs Four basic types of Top Level Window – JFrame, a top level window decorated like a native window – JWindow, an undecorated stand-alone.
Graphical User Interfaces
JAVA1 1. JFrame. JAVA2 JApplet import java.awt.*; import java.awt.event.*; import javax.swing.*; public class HerhalingAppletH10 extends JApplet implements.
Web Design & Development Lecture 19. Java Graphics 2.
CSE 1341 Honors Professor Mark Fontenot Southern Methodist University Note Set 21.
Advance Java Technology Java’s Role::MVC Architecture :: Swing Prof.Chintan Dave.
Graphics and event-driven programs Learning objectives By the end of this lecture you should be able to: identify and use some of the common components.
Graphical User Interfaces Java’s AWT and Swing APIs.
Graphical User Interfaces (Part IV)
Java Software Development Paradigm Lecture # 12. Basics of GUI.
Drawing in a frame – Java GUI
CS18000: Problem Solving and Object-Oriented Programming.
Unit 3 Graphical User Interface (GUI) Dr. Magdi AMER.
Graphic User Interfaces Layout Managers Event Handling.
F27SB2 Programming Languages
Problem Solving 6 GUIs and Event Handling ICS-201 Introduction to Computing II Semester 071.
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.
Things to mention public static void main(String [] args) –The starting point for a free-standing Java application (i.e. one not run from the DrJava interactions.
JAVA API (GUI) Subject:T0934 / Multimedia Programming Foundation Session:1 Tahun:2009 Versi:1/0.
User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Unit 091 Introduction to GUI Programming Introduction to User Interfaces Introduction to GUI Programming GUI Design Issues GUI Programming Issues Java.
Creating a GUI with Swing. Introduction Very useful link: Swing – is a part of JFC (Java Foundation.
Unit 111 Java GUI Components and Events  Learning Outcomes oDistinguish between GUI components and containers. oIdentify and distinguish top-level containers.
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
GUI Programming in Java Tim McKenna GUI Programming Concepts l conventional programming: sequence of operations is determined by the program.
Java Swing Chris North cs3724: HCI. AWT to Swing AWT: Abstract Windowing Toolkit import java.awt.* Swing: new with Java2 import javax.swing.* Extends.
GUI Programming in Java
Chapter 13 Advanced GUIs and Graphics. Chapter Objectives Learn about applets Explore the class Graphics Learn about the class Font Explore the class.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
JAPPLET.
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.
Object Oriented Programming Ders 11: Interfaces Mustafa Emre İlal
Java GUI CSCE 190 – Java Instructor: Joel Gompert Mon, July 26, 2004.
Chapter 9: Visual Programming Basics Object-Oriented Program Development Using Java: A Class-Centered Approach.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
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 GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
Creating Applets. What is an applet? What is an applet? A Java program that runs in a web browser. A Java program that runs in a web browser. An applet.
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
1 Applets. 2 Design of Applets 3 Sun wrote Java to be executable within a hosting application browser The applications are applets. An applet is downloaded.
CIS Intro to JAVA Lecture Notes Set 8 9-June-05.
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.
Java Swing One of the most important features of Java is its ability to draw graphics.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Lesson 28: More on the GUI button, frame and actions.
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.
Java Swing. Graphical User Interfaces (GUIs) GUI: An application that uses graphical objects to interact with users GUI applications consist of: – Events:
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.
Chapter 6 Building Java GUIs. MVC Model View Controller The model passes its data to the view for rendering The view determines which events are passed.
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
Java Swing.
Graphical User Interface (pronounced "gooey")
Lecture 27 Creating Custom GUIs
Ellen Walker Hiram College
Chapter 13: Advanced GUIs and Graphics
Event Driven Programming and Graphical User Interface
תכנות מכוון עצמים בשפת JAVA
Applets.
Steps to Creating a GUI Interface
Advanced GUIs and Graphics
Presentation transcript:

User Interfaces II GUI – Awt, Swing, Web (c) IDMS/SQL News http://www.geocities.com/idmssql

User Interfaces - recap In Java one can create at least 3 types of programs Applet Servlet/JSP Windows Java Class GUI - Introduction (c)http://www.geocities.com/idmssql

Graphical User Interface Started with AWT – Abstract Windowing Toolkit Later came Swing Today AWT components are included in Swing AWT components are called heavyweight Swing components are called lightweight Gui is based on events which are generated by things like mouse, button, list selections, window close operations, menu pulldowns, etc GUI - Introduction (c)http://www.geocities.com/idmssql

GUI - Introduction (c)http://www.geocities.com/idmssql Top Level GUI Swing Containers – Top Level - JFrame - JDialog -JApplet All three support some common methods like setMenuBar(), getContentPane() ‘J’ stands for components in Swing... Without ‘J’ they are usually part of AWT GUI - Introduction (c)http://www.geocities.com/idmssql

GUI - Introduction (c)http://www.geocities.com/idmssql GUI Jargons One of the negative(!) things about new technology is the overuse of common words and known technical words in a totally different sense! So we hear terms like component, container, layout, listener, Frame, Panel, Window, Dialog ... a never ending list We have to live with this!!! GUI - Introduction (c)http://www.geocities.com/idmssql

GUI Objects – at lower level GUI is based on 3 types of objects Containers - JPanel, JScrollPane etc Selectors - JButton, JTextField, JCheckBox etc Info Display JTextArea, JTable etc (editable) JLabel, JProgressBar etc (non-editable) GUI - Introduction (c)http://www.geocities.com/idmssql

GUI - Introduction (c)http://www.geocities.com/idmssql Sample Methods ... Paint(), setFont(), setSize() ... setLayout() setBoarder(), setToolTipText(), setOpaque() ... the list is endless... GUI - Introduction (c)http://www.geocities.com/idmssql

GUI - Introduction (c)http://www.geocities.com/idmssql Example : GuiSample1 import java.awt.*; import javax.swing.*; // Packages used import java.awt.event.*; public class GuiSample1 extends JFrame { JButton myButton = new JButton("Press Here"); JTextArea myArea = new JTextArea(10,20); public void setupGUI() { setTitle("S212 - Java Crash Course"); myButton.setEnabled(true); Container c = getContentPane(); c.setLayout(new FlowLayout()); c.add(myButton); c.add(myArea); setSize(400,300); } See next Page GUI - Introduction (c)http://www.geocities.com/idmssql

GUI - Introduction (c)http://www.geocities.com/idmssql Gui Code continued... // we need a main to instantiate and execute this class public static void main(String args[]) { GuiSample1 dec18 = new GuiSample1(); dec18.setupGUI(); dec18.setVisible(true); dec18.myArea.setEditable(false); // Quit the application when the user 'closes' the Window f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);} }); }//main } // The above code does very little, but is complete. GUI - Introduction (c)http://www.geocities.com/idmssql

GUI - Introduction (c)http://www.geocities.com/idmssql GUI .. note ... The class extends JFrame Container is created by getContentPane() setLayout method is used Buttons etc added by add(...) command Main () gets controll first Main instantiate a new object ‘dec18’ Method setupGUI does the housekeeping... We utilize a standard ‘WindowsListener’ mechanism to close. A complete example is given as GuiSample1.java GUI - Introduction (c)http://www.geocities.com/idmssql

GUI - Introduction (c)http://www.geocities.com/idmssql Applet Applets are Java classes run from WWW Applets do not have main method Html file will have tags like <applet code=“Hello5.class" width=”400" height=”325"></applet> More on applets later ... Sample Java code follows GUI - Introduction (c)http://www.geocities.com/idmssql

GUI - Introduction (c)http://www.geocities.com/idmssql Applet sample code /*Applet program hello5.java*/ import java.applet.Applet; import java.awt.*; public class Hello5 extends Applet { public void paint(Graphics screen) { screen.drawString("Hello World",50,25); screen.drawRoundRect(20, 40, 100, 100, 30,10); }//end paint() } //End hello5 class. GUI - Introduction (c)http://www.geocities.com/idmssql