Graphical Interfaces
|
|
- Stewart Cain
- 6 years ago
- Views:
Transcription
1 Weeks 9&11 Graphical Interfaces All the programs that you have created until now used a simple command line interface, which is not user friendly, so a Graphical User Interface (GUI) should be used. The components of a graphical interface are control elements named widgets activated by the user with the mouse or the keyboard. When activated, a control element will generate a certain answer, according to the program. Most graphical interfaces are based on windows. This means that each active application will have a rectangular area on the screen. All the necessary control elements for the user-application dialog will be placed into this window. In order for an application using the graphical interface to run we need a graphical server to put the screen in the graphical state and to offer the necessary functions to draw and control GUI components. How to create an application window A graphical application will always have a main window. You can create this window using the class java.awt.frame which contains the necessary elements to build a window. import java.awt.*; class MyWindow extends Frame public MyWindow(String title) super(title); Toolkit t = Toolkit.getDefaultToolkit(); Dimension d = t.getscreensize(); int h = d.height; int w = d.width; setsize(w/2, h/2); setlocation(w/4, h/4); class FirstWindow public static void main(string[] args) Frame f = new MyWindow("My first window"); f.setvisible(true); When the user acts in some way over an element of a GUI using the mouse or the keyboard, an event will appear, the GUI s element being the source of the event. If you want an answer from an 1
2 element you should handle the event. This means that someone has to catch the event and to execute a certain function. Handling events in Java When you act over a GUI s element, an object a predefined class (java.awt.event) will be created. If there is a listener object of the created event and this object is known to the source of the event, then a method having as parameter the event object will be called. Of course, the programmer should define first this method. Different elements will generate different events. When you act over a window a java.awt.event.windowevent object will be created and when acting over a button a java.awt.event.actionevent object will be created. The event handler is an object having methods with predefined names from predefined interfaces. There is an interface for every event type. For example, to handle a WindowEvent one has to implement WindowListener interface. The method s name reflects the action executed over an element. The interface WindowListener has the following methods: public void windowactivated(windowevent e); public void windowclosed(windowevent e); public void windowclosing(windowevent e); public void windowdeactivated(windowevent e); public void windowdeiconified(windowevent e); public void windowiconified(windowevent e); public void windowopened(windowevent e); To link an event handler to its source the following syntax is needed: EventSourceObject.addEvenimentListener(EventHandlerObject); import java.awt.*; import java.awt.event.*; class MyWindowHandler implements WindowListener public void windowclosing(windowevent e) System.exit(0); // all the methods from WindowListener interface class MyWindow extends Frame public MyWindow(String title) 2
3 super(title); MyWindowHandler r = new MyWindowHandler(); this.addwindowlistener(r); Toolkit t = Toolkit.getDefaultToolkit(); Dimension d = t.getscreensize(); int h = d.height; int w = d.width; setsize(w/2, h/2); setlocation(w/4, h/4); class FirstWindow public static void main(string[] args) Frame f = new MyWindow("The first window"); f.sevisible(true); How to put elements in a window? You have to create objects of the classes which model the elements. Then, for each element you have to use the method add to place them into the window. You can specify where to put an element in the window using layout managers like FlowLayout or BorderLayout. A button in Java is modeled in the class called Button. A button can generate an ActionEvent, when the user clicks on it. The handler of such an event should implement the interface ActionListener, which contains only a method: actionperformed. To an easy control of the relations from the GUI s elements, the applications should be designed accordingly with the following designing template: a class to describe the window; a class for the handler of the possible events; a class to mediate the dialogs, which creates the GUI s elements, put them into the window and, after an event, updates the elements state.. import java.awt.*; import java.awt.event.*; class MyWindowHandler extends WindowAdapter implements ActionListener private Mediator m; public MyWindowHandler(Mediator m) this.m = m; public void windowclosing(windowevent e) 3
4 System.exit(0); public void actionperformed(actionevent e) m.buttonpressed(); class Mediator public Mediator(Frame f) this.f = f; public void assembleframe() MyWindowHandler r = new MyWindowHandler(this); f.addwindowlistener(r); b = new Button("Push"); b.addactionlistener(r); lb = new Label("0"); f.setlayout(new FlowLayout()); f.add(b); f.add(lb); f.setvisible(true); public void buttonpressed() contor++; lb.settext(""+counter); private int counter=0; private Frame f; private Button b; private Label lb; class MyWindow extends Frame public MyWindow(String title) super(title); Toolkit t = Toolkit.getDefaultToolkit(); Dimension d = t.getscreensize(); int h = d.height; int w = d.width; setsize(w/2, h/2); setlocation(w/4, h/4); class FirstWindow 4
5 public static void main(string[] args) Frame f = new MyWindow("My first window"); Mediator m = new Mediator(f); m.assembleframe(); If there are more than one buttons in a window, you can use the following situations for their handlers: create two different classes for the event handlers of the two buttons and define accordingly the method actionperformed; use the information from the generated ActionEvent object, sent as parameter to the method actionperformed. A possibility is to use the method public Object getsource(); Problem week 9 Change the above example to have two buttons, a label and a checkbox. By default, button 1 is enabled, button 2 is disabled and the checkbox is unchecked. When you check the checkbox, button 2 will be enabled and button 1 will be disabled. When you push button 1, the label s content will be incremented and pushing button 2 the label s content will be decremented. The starting label s value is 0. Reading data from the keyboard To read data from the keyboard, a TextField object is needed. The following example shows you how to read the elements of an array using: o a text field to read the elements from the keyboard, o a button to insert an element into a location in the array, o a label to point the index of the current element in the array. import java.awt.*; import java.awt.event.*; class Table private int[] tab; public Table(int n) tab=new int[n]; public void setelem(int i, int val) 5
6 tab[i]=val; public int getdim() return tab.length; class MyWindowHandler extends WindowAdapter implements ActionListener private Mediator m; public MyWindowHandler (Mediator m) this.m=m; public void windowclosing(windowevent e) System.exit(0); public void actionperformed(actionevent e) m.buttonpressed(); class Mediator public Mediator(Frame f, Table t) this.f=f; this.t=t; public void assembleframe() MyWindowHandler r = new MyWindowHandler (this); f.addwindowlistener(r); b = new Button("Insert"); b.addactionlistener(r); lb = new Label("Element 0"); tx = new TextField(15); f.setlayout(new FlowLayout()); f.add(b); f.add(tx); f.add(etic); f.show(); public void buttonpressed() if (counter < t.getdim()) try 6
7 int val = Integer.parseInt(tx.getText()); t.setelem(counter,val); counter++; lb.settext("element "+contor); tx.settext(""); catch (NumberFormatException e) lb.settext("wrong format number ); else lb.settext("array full"); private int counter=0; private Tablou t; private Frame f; private Button b; private Label lb; private TextField tx; class MyWindow extends Frame public MyWindow (String title) super(title); Toolkit t = Toolkit.getDefaultToolkit(); Dimension d = t.getscreensize(); int h = d.height; int w = d.width; setsize(w/2, h/2); setlocation(w/4, h/4); class MainProgram public static void main(string[] args) Frame f = new MyWindow ("Array example"); Table t = new Table(10); Mediator m = new Mediator(f,t); m.assembleframe(); 7
8 Problem week 11 Create a GUI to contain a text field, text area, a button and a label. If there is a text written in the text field, pressing the button will move the text from the text field to the text area, otherwise a dialog will appear pointing that there is no text in the text field. The label will show how many values are written in the text area. The program will end when inside the text field the key e is written. 8
Graphical Interfaces
Weeks 11&12 Graphical Interfaces All the programs that you have created until now used a simple command line interface, which is not user friendly, so a Graphical User Interface (GUI) should be used. The
More informationJava - Applications. The following code sets up an application with a drop down menu, as yet the menu does not do anything.
Java - Applications C&G Criteria: 5.3.2, 5.5.2, 5.5.3 Java applets require a web browser to run independently of the Java IDE. The Dos based console applications will run outside the IDE but have no access
More informationChapter 1 GUI Applications
Chapter 1 GUI Applications 1. GUI Applications So far we've seen GUI programs only in the context of Applets. But we can have GUI applications too. A GUI application will not have any of the security limitations
More informationJava Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing
Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing Rui Moreira Some useful links: http://java.sun.com/docs/books/tutorial/uiswing/toc.html http://www.unix.org.ua/orelly/java-ent/jfc/
More informationCSEN401 Computer Programming Lab. Topics: Graphical User Interface Window Interfaces using Swing
CSEN401 Computer Programming Lab Topics: Graphical User Interface Window Interfaces using Swing Prof. Dr. Slim Abdennadher 22.3.2015 c S. Abdennadher 1 Swing c S. Abdennadher 2 AWT versus Swing Two basic
More informationProgramming Languages and Techniques (CIS120e)
Programming Languages and Techniques (CIS120e) Lecture 29 Nov. 19, 2010 Swing I Event- driven programming Passive: ApplicaHon waits for an event to happen in the environment When an event occurs, the applicahon
More informationกล ม API ท ใช. Programming Graphical User Interface (GUI) Containers and Components 22/05/60
กล ม API ท ใช Programming Graphical User Interface (GUI) AWT (Abstract Windowing Toolkit) และ Swing. AWT ม ต งต งแต JDK 1.0. ส วนมากจะเล กใช และแทนท โดยr Swing components. Swing API ปร บปร งความสามารถเพ
More informationExample Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.
COSC User Interfaces Module 3 Sequential vs. Event-driven Programming Example Programs DemoLargestConsole.java DemoLargestGUI.java Demo programs will be available on the course web page. GUI Program Organization
More information1 of :32:42
1 2 package oop4_dat4_u; 3 4 /** 5 * 6 * @author Felix Rohrer 7 */ 8 public class Main { 9 10 /** 11 * @param args the command line arguments 12 */ 13 public static void main(string[]
More informationFORMAS DE IMPLEMENTAR LOS OYENTES. A).- El oyente en una clase independiente con el constructor con un argumento y usando el método getactioncommand.
FORMAS DE IMPLEMENTAR LOS OYENTES A).- El oyente en una clase independiente con el constructor con un argumento y usando el método getactioncommand. public class VentanaOyente extends Frame{ private Oyente
More informationGUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline
Sequential vs. Event-driven Programming Reacting to the user GUI Program Organization Let s digress briefly to examine the organization of our GUI programs We ll do this in stages, by examining three example
More informationControl Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User
CSE3461 Control Flow Paradigms: Reacting to the User Control Flow: Overview Definition of control flow: The sequence of execution of instructions in a program. Control flow is determined at run time by
More informationThe AWT Event Model 9
The AWT Event Model 9 Course Map This module covers the event-based GUI user input mechanism. Getting Started The Java Programming Language Basics Identifiers, Keywords, and Types Expressions and Flow
More informationBM214E Object Oriented Programming Lecture 13
BM214E Object Oriented Programming Lecture 13 Events To understand how events work in Java, we have to look closely at how we use GUIs. When you interact with a GUI, there are many events taking place
More informationUniversity of Cape Town ~ Department of Computer Science. Computer Science 1016S / 1011H ~ November Exam
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1016S / 1011H ~ 2009 November Exam Question
More informationWindow Interfaces Using Swing Objects
Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs
More informationMIT AITI Swing Event Model Lecture 17
MIT AITI 2004 Swing Event Model Lecture 17 The Java Event Model In the last lecture, we learned how to construct a GUI to present information to the user. But how do GUIs interact with users? How do applications
More informationWindow Interfaces Using Swing Objects
Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs
More informationProgramming Language Concepts: Lecture 8
Programming Language Concepts: Lecture 8 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 8, 11 February 2009 GUIs and event
More informationOBJECT ORIENTED PROGRAMMING. Java GUI part 1 Loredana STANCIU Room B616
OBJECT ORIENTED PROGRAMMING Java GUI part 1 Loredana STANCIU loredana.stanciu@upt.ro Room B616 What is a user interface That part of a program that interacts with the user of the program: simple command-line
More informationInteracción con GUIs
Interacción con GUIs Delegation Event Model Fuente EVENTO Oyente suscripción Fuente Oyente suscripción EVENTO Adaptador EVENTO java.lang.object java.util.eventobject java.awt.awtevent java.awt.event. ActionEvent
More informationPackages: Putting Classes Together
Packages: Putting Classes Together 1 Introduction 2 The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance) Extending interfaces The features in basic
More information11/7/12. Discussion of Roulette Assignment. Objectives. Compiler s Names of Classes. GUI Review. Window Events
Objectives Event Handling Animation Discussion of Roulette Assignment How easy/difficult to refactor for extensibility? Was it easier to add to your refactored code? Ø What would your refactored classes
More informationRAIK 183H Examination 2 Solution. November 10, 2014
RAIK 183H Examination 2 Solution November 10, 2014 Name: NUID: This examination consists of 5 questions and you have 110 minutes to complete the test. Show all steps (including any computations/explanations)
More informationRAIK 183H Examination 2 Solution. November 11, 2013
RAIK 183H Examination 2 Solution November 11, 2013 Name: NUID: This examination consists of 5 questions and you have 110 minutes to complete the test. Show all steps (including any computations/explanations)
More informationBuilding Graphical User Interfaces. GUI Principles
Building Graphical User Interfaces 4.1 GUI Principles Components: GUI building blocks Buttons, menus, sliders, etc. Layout: arranging components to form a usable GUI Using layout managers. Events: reacting
More informationGraphical User Interfaces (GUIs)
CMSC 132: Object-Oriented Programming II Graphical User Interfaces (GUIs) Department of Computer Science University of Maryland, College Park Model-View-Controller (MVC) Model for GUI programming (Xerox
More informationGUI in Java TalentHome Solutions
GUI in Java TalentHome Solutions AWT Stands for Abstract Window Toolkit API to develop GUI in java Has some predefined components Platform Dependent Heavy weight To use AWT, import java.awt.* Calculator
More information(Incomplete) History of GUIs
CMSC 433 Programming Language Technologies and Paradigms Spring 2004 Graphical User Interfaces April 20, 2004 (Incomplete) History of GUIs 1973: Xerox Alto 3-button mouse, bit-mapped display, windows 1981:
More informationCSE 8B Intro to CS: Java
CSE 8B Intro to CS: Java Winter, 2006 February 23 (Day 14) Menus Swing Event Handling Inner classes Instructor: Neil Rhodes JMenuBar container for menus Menus associated with a JFrame via JFrame.setMenuBar
More informationCourse: CMPT 101/104 E.100 Thursday, November 23, 2000
Course: CMPT 101/104 E.100 Thursday, November 23, 2000 Lecture Overview: Week 12 Announcements Assignment 6 Expectations Understand Events and the Java Event Model Event Handlers Get mouse and text input
More information7. Program Frameworks
7. Program Frameworks Overview: 7.1 Introduction to program frameworks 7.2 Program frameworks for User Interfaces: - Architectural properties of GUIs - Abstract Window Toolkit of Java Many software systems
More informationFunctors - Objects That Act Like Functions
Steven Zeil October 25, 2013 Contents 1 Functors in Java 2 1.1 Functors............. 2 1.2 Immediate Classes....... 6 2 Functors and GUIs 8 2.1 Java Event Listeners....... 10 3 Functors in C++ 22 3.1 operator()............
More informationAn Introduction To Graphical User Interfaces
An Introduction To Graphical User Interfaces The event-driven model Building simple graphical interfaces in Java Components They are all types of graphical controls and displays available: Button, Canvas,
More informationThe Abstract Windowing Toolkit. Java Foundation Classes. Swing. In April 1997, JavaSoft announced the Java Foundation Classes (JFC).
The Abstract Windowing Toolkit Since Java was first released, its user interface facilities have been a significant weakness The Abstract Windowing Toolkit (AWT) was part of the JDK form the beginning,
More informationGUI Programming: Swing and Event Handling
GUI Programming: Swing and Event Handling Sara Sprenkle 1 Announcements No class next Tuesday My Fourth of July present to you: No quiz! Assignment 3 due today Review Collections: List, Set, Map Inner
More informationSwing from A to Z Some Simple Components. Preface
By Richard G. Baldwin baldwin.richard@iname.com Java Programming, Lecture Notes # 1005 July 31, 2000 Swing from A to Z Some Simple Components Preface Introduction Sample Program Interesting Code Fragments
More informationBuilding Graphical User Interfaces. Overview
Building Graphical User Interfaces 4.1 Overview Constructing GUIs Interface components GUI layout Event handling 2 1 GUI Principles Components: GUI building blocks. Buttons, menus, sliders, etc. Layout:
More informationG51PRG: Introduction to Programming Second semester Applets and graphics
G51PRG: Introduction to Programming Second semester Applets and graphics Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk Previous two lectures AWT and Swing Creating components and putting
More informationCSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT
CSE 143 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/
More informationOverview. Building Graphical User Interfaces. GUI Principles. AWT and Swing. Constructing GUIs Interface components GUI layout Event handling
Overview Building Graphical User Interfaces Constructing GUIs Interface components GUI layout Event handling 4.1 GUI Principles AWT and Swing Components: GUI building blocks. Buttons, menus, sliders, etc.
More informationJava. GUI building with the AWT
Java GUI building with the AWT AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses the controls defined by your OS therefore
More informationIntroduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008
Introduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008 Announcements A3 is up, due Friday, Oct 10 Prelim 1 scheduled for Oct 16 if you have a conflict, let us know now 2 Interactive
More informationIntroduction. Introduction
Introduction Many Java application use a graphical user interface or GUI (pronounced gooey ). A GUI is a graphical window or windows that provide interaction with the user. GUI s accept input from: the
More informationSE1021 Exam 2. When returning your exam, place your note-sheet on top. Page 1: This cover. Page 2 (Multiple choice): 10pts
SE1021 Exam 2 Name: You may use a note-sheet for this exam. But all answers should be your own, not from slides or text. Review all questions before you get started. The exam is printed single-sided. Write
More informationSD Module-1 Advanced JAVA
Assignment No. 4 SD Module-1 Advanced JAVA R C (4) V T Total (10) Dated Sign Title: Transform the above system from command line system to GUI based application Problem Definition: Write a Java program
More informationAWT WINDOW CLASS. The class Window is a top level window with no border and no menubar. It uses BorderLayout as default layout manager.
http://www.tutorialspoint.com/awt/awt_window.htm AWT WINDOW CLASS Copyright tutorialspoint.com Introduction The class Window is a top level window with no border and no menubar. It uses BorderLayout as
More informationSD Module-1 Advanced JAVA. Assignment No. 4
SD Module-1 Advanced JAVA Assignment No. 4 Title :- Transform the above system from command line system to GUI based application Problem Definition: Write a Java program with the help of GUI based Application
More informationGUI DYNAMICS Lecture July 26 CS2110 Summer 2011
GUI DYNAMICS Lecture July 26 CS2110 Summer 2011 GUI Statics and GUI Dynamics 2 Statics: what s drawn on the screen Components buttons, labels, lists, sliders, menus,... Containers: components that contain
More informationAWT TEXTFIELD CLASS. Constructs a new empty text field with the specified number of columns.
http://www.tutorialspoint.com/awt/awt_textfield.htm AWT TEXTFIELD CLASS Copyright tutorialspoint.com Introduction The textfield component allows the user to edit single line of text.when the user types
More informationThe AWT Package, Placing Components in Containers, CardLayout. Preface. Introduction
Richard G Baldwin (512) 223-4758, baldwin@austin.cc.tx.us, http://www2.austin.cc.tx.us/baldwin/ The AWT Package, Placing Components in Containers, CardLayout Java Programming, Lecture Notes # 120, Revised
More informationBuilding a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver
Building a GUI in Java with Swing CITS1001 extension notes Rachel Cardell-Oliver Lecture Outline 1. Swing components 2. Building a GUI 3. Animating the GUI 2 Swing A collection of classes of GUI components
More informationSystems Programming Graphical User Interfaces
Systems Programming Graphical User Interfaces Julio Villena Román (LECTURER) CONTENTS ARE MOSTLY BASED ON THE WORK BY: José Jesús García Rueda Systems Programming GUIs based on Java
More informationChapter 14. More Swing
Chapter 14 More Swing Menus Making GUIs Pretty (and More Functional) Box Containers and Box Layout Managers More on Events and Listeners Another Look at the Swing Class Hierarchy Chapter 14 Java: an Introduction
More informationSINGLE EVENT HANDLING
SINGLE EVENT HANDLING Event handling is the process of responding to asynchronous events as they occur during the program run. An event is an action that occurs externally to your program and to which
More informationAWT DIALOG CLASS. Dialog control represents a top-level window with a title and a border used to take some form of input from the user.
http://www.tutorialspoint.com/awt/awt_dialog.htm AWT DIALOG CLASS Copyright tutorialspoint.com Introduction Dialog control represents a top-level window with a title and a border used to take some form
More informationProgramming Mobile Devices J2SE GUI
Programming Mobile Devices J2SE GUI University of Innsbruck WS 2009/2010 thomas.strang@sti2.at Graphical User Interface (GUI) Why is there more than one Java GUI toolkit? AWT write once, test everywhere
More informationGraphic User Interfaces. - GUI concepts - Swing - AWT
Graphic User Interfaces - GUI concepts - Swing - AWT 1 What is GUI Graphic User Interfaces are used in programs to communicate more efficiently with computer users MacOS MS Windows X Windows etc 2 Considerations
More informationJava & Graphical User Interface II. Wang Yang wyang AT njnet.edu.cn
Java & Graphical User Interface II Wang Yang wyang AT njnet.edu.cn Outline Review of GUI (first part) What is Event Basic Elements of Event Programming Secret Weapon - Inner Class Full version of Event
More informationFrames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling
Frames, GUI and events Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Introduction to Swing The Java AWT (Abstract Window Toolkit)
More information!"# $ %&# %####' #&() % # # # #&* # ## +, # -
By Pep Jorge @joseplluisjorge Steema Software July 213!"# $ %&# %####' #&() % # # # #&* # ## +, # -. / " - $- * 11 1 1$ 2 11 1 3 4 / $ 5 5,+67 +68$ Copyright 213 Steema Software SL. Copyright Information.
More informationJAVA NOTES GRAPHICAL USER INTERFACES
1 JAVA NOTES GRAPHICAL USER INTERFACES Terry Marris 24 June 2001 5 TEXT AREAS 5.1 LEARNING OUTCOMES By the end of this lesson the student should be able to understand how to get multi-line input from the
More informationAWT CHOICE CLASS. Choice control is used to show pop up menu of choices. Selected choice is shown on the top of the menu.
http://www.tutorialspoint.com/awt/awt_choice.htm AWT CHOICE CLASS Copyright tutorialspoint.com Introduction Choice control is used to show pop up menu of choices. Selected choice is shown on the top of
More information(listener)... MouseListener, ActionLister. (adapter)... MouseAdapter, ActionAdapter. java.awt AWT Abstract Window Toolkit GUI
51 6!! GUI(Graphical User Interface) java.awt javax.swing (component) GUI... (container) (listener)... MouseListener, ActionLister (adapter)... MouseAdapter, ActionAdapter 6.1 GUI(Graphics User Interface
More informationAdvanced Java Programming (17625) Event Handling. 20 Marks
Advanced Java Programming (17625) Event Handling 20 Marks Specific Objectives To write event driven programs using the delegation event model. To write programs using adapter classes & the inner classes.
More informationGUI Design. Overview of Part 1 of the Course. Overview of Java GUI Programming
GUI Design Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh spring@imap.pitt.edu http://www.sis.pitt.edu /~spring Overview of Part 1 of the Course Demystifying
More informationGraphical User Interface (Part-1) Supplementary Material for CPSC 233
Graphical User Interface (Part-1) Supplementary Material for CPSC 233 Introduction to Swing A GUI (graphical user interface) is a windowing system that interacts with the user The Java AWT (Abstract Window
More informationG51PGP Programming Paradigms. Lecture 008 Inner classes, anonymous classes, Swing worker thread
G51PGP Programming Paradigms Lecture 008 Inner classes, anonymous classes, Swing worker thread 1 Reminder subtype polymorphism public class TestAnimals public static void main(string[] args) Animal[] animals
More informationJava AWT Windows, Text, & Graphics
2 AWT Java AWT Windows, Text, & Graphics The Abstract Windows Toolkit (AWT) contains numerous classes and methods that allow you to create and manage applet windows and standard windows that run in a GUI
More informationAn Introduction To Graphical User Interfaces
An Introduction To Graphical User Interfaces The event-driven model Building simple graphical user interfaces (GUI s) in Java Note: GUI Code Cannot Be Run Through A Text- Only Connection: SSH [csb exampletwo
More informationCS211 GUI Dynamics. Announcements. Motivation/Overview. Example Revisted
CS211 GUI Dynamics Announcements Prelim 2 rooms: A-M are in Olin 155 N-A are in Olin 255 Final exam: final exam 5/17, 9-11:30am final review session (TBA, likely Sun 5/15) Consulting: regular consulting
More informationCHAPTER 2. Java Overview
Networks and Internet Programming (0907522) CHAPTER 2 Java Overview Instructor: Dr. Khalid A. Darabkh Objectives The objectives of this chapter are: To discuss the classes present in the java.awt package
More informationPreviously, we have seen GUI components, their relationships, containers, layout managers. Now we will see how to paint graphics on GUI components
CS112-Section2 Hakan Guldas Burcin Ozcan Meltem Kaya Muge Celiktas Notes of 6-8 May Graphics Previously, we have seen GUI components, their relationships, containers, layout managers. Now we will see how
More informationPoints Missed on Page page 1 of 8
Midterm II - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Name: ID: Problem #1 (8 points) Rewrite the following code segment using a for loop instead of a while loop (that is
More informationThe Abstract Window Toolkit
Chapter 12 The Abstract Window Toolkit 1 12.1 Overview Java s Abstract Window Toolkit provides classes and other tools for building programs that have a graphical user interface. The term Abstract refers
More informationJava Swing. Recitation 11/(20,21)/2008. CS 180 Department of Computer Science, Purdue University
Java Swing Recitation 11/(20,21)/2008 CS 180 Department of Computer Science, Purdue University Announcements Project 8 is out Milestone due on Dec 3rd, 10:00 pm Final due on Dec 10th, 10:00 pm No classes,
More informationCSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT
CSE 331 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/
More informationGUI Basics. Object Orientated Programming in Java. Benjamin Kenwright
GUI Basics Object Orientated Programming in Java Benjamin Kenwright Outline Essential Graphical User Interface (GUI) Concepts Libraries, Implementation, Mechanics,.. Abstract Windowing Toolkit (AWT) Java
More informationChapter 13 Lab Advanced GUI Applications
Gaddis_516907_Java 4/10/07 2:10 PM Page 113 Chapter 13 Lab Advanced GUI Applications Objectives Be able to add a menu to the menu bar Be able to use nested menus Be able to add scroll bars, giving the
More informationParts of a Contract. Contract Example. Interface as a Contract. Wednesday, January 30, 13. Postcondition. Preconditions.
Parts of a Contract Syntax - Method signature Method name Parameter list Return type Semantics - Comments Preconditions: requirements placed on the caller Postconditions: what the method modifies and/or
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: MVC e Observer 1 The Observer Pattern Intent Define a one-to-many dependency between objects so that when one object changes state, all its dependents are
More informationANSWER KEY Exam 2 Computer Programming 230 Dr. St. John Lehman College City University of New York Thursday, 5 November 2009
ANSWER KEY Exam 2 Computer Programming 230 Dr. St. John Lehman College City University of New York Thursday, 5 November 2009 1. True or False: (a) T In Alice, there is an event that is processed as long
More informationLaborator 2 Aplicatii Java
Laborator 2 Aplicatii Java Introducere in programarea vizuala - Pachetul AWT Scrieti, compilati si rulati toate exemplele din acest laborator: 1. import java.awt.*; class First extends Frame First() Button
More informationPart 3: Graphical User Interface (GUI) & Java Applets
1,QWURGXFWLRQWR-DYD3URJUDPPLQJ (( Part 3: Graphical User Interface (GUI) & Java Applets EE905-GUI 7RSLFV Creating a Window Panels Event Handling Swing GUI Components ƒ Layout Management ƒ Text Field ƒ
More informationIntroduction to the JAVA UI classes Advanced HCI IAT351
Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing
More informationClass 16: The Swing Event Model
Introduction to Computation and Problem Solving Class 16: The Swing Event Model Prof. Steven R. Lerman and Dr. V. Judson Harward 1 The Java Event Model Up until now, we have focused on GUI's to present
More informationComputer Programming Java AWT Lab 18
Computer Programming Java AWT Lab 18 엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University Copyrights 2015 DCSLab. All Rights Reserved Overview AWT Basic Use AWT AWT
More informationGraphical User Interfaces in Java - SWING
Graphical User Interfaces in Java - SWING Graphical User Interfaces (GUI) Each graphical component that the user can see on the screen corresponds to an object of a class Component: Window Button Menu...
More informationBasicsof. JavaGUI and SWING
Basicsof programming3 JavaGUI and SWING GUI basics Basics of programming 3 BME IIT, Goldschmidt Balázs 2 GUI basics Mostly window-based applications Typically based on widgets small parts (buttons, scrollbars,
More informationJAVA NOTES GRAPHICAL USER INTERFACES
1 JAVA NOTES GRAPHICAL USER INTERFACES Terry Marris July 2001 8 DROP-DOWN LISTS 8.1 LEARNING OUTCOMES By the end of this lesson the student should be able to understand and use JLists understand and use
More information1005ICT Object Oriented Programming Lecture Notes
1005ICT Object Oriented Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 2, 2015 1 20 GUI Components and Events This section develops a program
More informationJava Programming Lecture 6
Java Programming Lecture 6 Alice E. Fischer Feb 15, 2013 Java Programming - L6... 1/32 Dialog Boxes Class Derivation The First Swing Programs: Snow and Moving The Second Swing Program: Smile Swing Components
More informationGUI and its COmponent Textfield, Button & Label. By Iqtidar Ali
GUI and its COmponent Textfield, Button & Label By Iqtidar Ali GUI (Graphical User Interface) GUI is a visual interface to a program. GUI are built from GUI components. A GUI component is an object with
More informationCS11 Java. Fall Lecture 4
CS11 Java Fall 2006-2007 Lecture 4 Today s Topics Interfaces The Swing API Event Handlers Inner Classes Arrays Java Interfaces Classes can only have one parent class No multiple inheritance in Java! By
More informationInterfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics
Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics 1 Collections (from the Java tutorial)* A collection (sometimes called a container) is simply an object that
More informationCSA 1019 Imperative and OO Programming
CSA 1019 Imperative and OO Programming GUI and Event Handling Mr. Charlie Abela Dept. of of Artificial Intelligence Objectives Getting familiar with UI UI features MVC view swing package layout managers
More informationCOSC 123 Computer Creativity. Graphics and Events. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 123 Computer Creativity Graphics and Events Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Draw shapes, text in various fonts, and colors. 2) Build
More informationGraphical User Interfaces
Graphical User Interfaces CSCI 136: Fundamentals CSCI 136: Fundamentals of Computer of Science Computer II Science Keith II Vertanen Keith Vertanen Copyright 2011 Overview Command line versus GUI apps
More informationJRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();
Q)Write a program to design an interface containing fields User ID, Password and Account type, and buttons login, cancel, edit by mixing border layout and flow layout. Add events handling to the button
More informationThe Java Programming Language Basics. Identifiers, Keywords, and Types. Expressions and Flow Control. Object-Oriented Programming. Objects and Classes
Building GUIs 8 Course Map This module covers setup and layout of graphical user interfaces. It introduces the Abstract Windowing Toolkit, a package of classes from which GUIs are built. Getting Started
More information