Outline. Composite Pattern. Model-View-Controller Pattern Callback Pattern
|
|
- Dustin Edwards
- 5 years ago
- Views:
Transcription
1 Outline Composite Pattern Motivation Structure Transparent vs Safe composite Applications: AWT & Swing Composite Problems: Alias references Model-View-Controller Pattern Callback Pattern 1
2 Composite Pattern Intent Representation of recursive part-whole hierarchies Individual objects and compositions of objects should be treated uniformly Motivation Operations applied uniformly on composites and single objects: move draw resize copy 2
3 Composite Pattern Example: File Structures Operations applied uniformly on composites and single objects: getsize setproperties delete 3
4 Composite Pattern Example: Menus Operations applied uniformly on composites and single objects: setname setenabled setmarked 4
5 Composite Pattern: Structure Figure draw() move(dx, dy) * parts Rectangle Oval Line GroupFigure draw() move(dx, dy) 0..1 for(figure f : parts) { f.draw(); } 5
6 Composite Pattern: Structure Composition B is a fixed part of A A * B Part may be part of at most one whole If whole is deleted, then also all its parts Whole acts substitutional for its parts, i.e. operations are propagated to its parts Sample: Car Tree structure Aggregation B is a variable part of A A * B Part may be part of several wholes Part may exist individually Sample: Organizational structure DAG structure 6
7 Composite Pattern: Structure 7
8 Composite Pattern: Structure Component operation() * parts Leaf operation() for(component c : parts) { c.operation(); } Composite operation() add(component) remove(component) getcomponents()
9 Composite Pattern: Participants Component Declares the interface for the objects in the composition Implements the default behavior Optionally: declares methods for accessing and managing child objects Leaf Defines behavior for primitive objects Composite Stores children references Defines behavior for components having children Implements methods for accessing and managing child objects Client Manipulates objects through the Component interface 9
10 Composite Pattern: Structure Component operation() add(component) remove(component) getcomponents() * parts Leaf operation() for(component c : parts) { c.operation(); } Composite operation() add(component) remove(component) getcomponents()
11 SAFE TRANSPARENT Composite Pattern Where should we define the Composite-specific methods? public void add(component c) { } public void remove(component c) { } public List<Component> getcomponents() { } // immutable list In Component In Composite 11
12 Composite Pattern: Transparent Approach How do we implement the composite-methods in the leaf nodes? Leafs can be seen as composites which never have children. Variant 1: Methods throw an exception for the leaf objects public void add(component c) { throw new UnsupportedOperationException(); } public void remove(component c) { throw new UnsupportedOperationException(); } public List getcomponents() { throw new UnsupportedOperationException(); } We need a possibility to check whether an object is a composite or not (program flow should not be controlled with exceptions) Exceptions may violate the contract (has to be documented) Method getcomponents could also return an empty list Only transparent on the interface level 12
13 Composite Pattern: Transparent Approach How do we implement the composite-methods in the leaf nodes? Leafs can be seen as composites which never have children Variant 2: Methods return a boolean result which informs the client whether the operation was successful public boolean add(component c) { return false; } public boolean remove(component c) { return false; } public List getcomponents() {return Collections.EMPTY_LIST;} With getcomponents().size() we can check whether the composite contains components or not We cannot test whether an object is a container or a component (as expected for a transparent solution), it either allows to add components or it does not. 13
14 Composite Pattern: Transparent Approach How do we implement the composite-methods in the leaf nodes? Leafs can be seen as composites which never have children Variant 3: Method iscomposite can be used to check whether a component is a composite or not Methods add/remove would declare iscomposite() as a precondition. public boolean iscomposite() { return false; } public void add(component c) { throw new AssertionError(); } public void remove(component c){throw new AssertionError();} public List getcomponents() {return Collections.EMPTY_LIST;} 20 April
15 Composite Pattern: Transparent Approach How do we implement the composite-methods in the leaf nodes? Leafs can be seen as composites which never have children Variant 4: default behavior is that nothing is done. Composites may strengthen this semantics. public void add(component c) { /* do nothing */ } public void remove(component c) { /* do nothing */ } public List getcomponents() {return Collections.EMTPY_LIST;} Truly transparent solution, but contracts for add/remove are weak, i.e. they only define that element is added/removed or not. Optionally, an additional method iscomposite() may be added (somehow violating the idea of transparency) Variant 5: Provide the full functionality 20 April
16 Composite Pattern: AWT Example AWT Component Button Label Container Checkbox Choice add(component) remove(component) getcomponent(int i)
17 Composite Pattern: Swing Example Swing JComponent add(component) remove(component) getcomponent(int i) JList JLabel JPanel JCheckBox JTable 17
18 Composite Pattern: AWT & Swing Component Button Label Container Checkbox Choice add(component) remove(component) getcomponent(int i) 0..1 JComponent add(component) remove(component) getcomponent(int i) JList JLabel JPanel JCheckBox JTable 18
19 Composite Pattern: AWT & Swing public class ButtonOnButton { public static void main(string[] args) { JButton b = new JButton("Button"); b.setlayout(new FlowLayout()); b.add(new JLabel("Label")); b.add(new JButton("Hallo")); } } JFrame p = new JFrame(); p.add(b); p.pack(); p.setvisible(true); 19
20 Composite Pattern: JavaFX Scene Graphs javafx.scene.node base class for scene graph nodes Node Camera MediaView Parent Shape ImageView #getchildren() +getchildrenunmodifiable() 0..1 Circle Rectangle Text 20
21 Composite Pattern: JavaFX Scene Graphs javafx.scene.parent base class for all nodes that have children in the scene graph getchildren is typically overridden to promote it to be public Parent #getchildren() +getchildrenunmodifiable() Region Group Control Slider TextInputControl 21
22 Composite: GroupFigure GroupFigures public class GroupFigure implements Figure { public GroupFigure(Figure... figures) { for (Figure f : figures) { addfigure(f); } } public void addfigure(figure f) {... } }... We assume that classes RectangleFigure and OvalFigure are available 22
23 Composite: GroupFigure Problem 1: Figure f1 = new RectangleFigure(... ); Figure f2 = new RectangleFigure(... ); Figure f3 = new OvalFigure(... ); GroupFigure g1 = new GroupFigure(f1, f2); GroupFigure g2 = new GroupFigure(f3, f1); 23
24 Composite: GroupFigure Problem 2: Figure f1 = new RectangleFigure(... ); Figure f2 = new RectangleFigure(... ); Figure f3 = new OvalFigure(... ); GroupFigure g1 = new GroupFigure(f1, f2); GroupFigure g2 = new GroupFigure(g1, f3); g1.addfigure(g2); 24
25 Composite: adding components void add(component c) { // 1. Check 0..1 constraint if(c.parent!= null) { throw new IllegalArgumentException("constraint violation"); } // 2. Check for recursion if(c instanceof Composite) { Composite comp = this; while (comp.parent!= null) { comp = comp.parent; } if(comp == c) { throw new IllegalArgumentException("recursion"); } } c.parent = this;... 25
26 Composite: adding components void add(component c) { // 1. Check for recursion if(c instanceof Composite) { Composite comp = this; while (comp!= null && comp!= c) { comp = comp.parent; } if(comp == c) { throw new IllegalArgumentException("recursion"); } } // 2. Establish 0..1 constraint if(c.parent!= null) { c.parent.remove(c); } c.parent = this;... 26
27 Composite: adding components SWT / Windows Parent reference has to be passed when the component is constructed Component may belong to at most one container Button(Composite parent, int style) // Constructs a new instance of this class given its // parent and a style value describing its behavior // and appearance. 27
28 Outline Composite Pattern Model-View-Controller Pattern Callback Pattern 28
29 Model-View-Controller (MVC) Compound Pattern A set of patterns working together that solves a recurring or general problem Model-View-Controller Software architecture pattern which separates the representation of information from the user's interaction with it Model: View: Controller: representation of application data & business logic presentation of the data (multiple views are possible) and the source of user interaction controls and mediates input, forwards it to the model 29
30 Model-View-Controller (MVC) Interactions View Model Controller * 5 1 * Controller reacts on user input and initiates state transfer on the model 2. Controller can update view directly (e.g. scrolling) 3. Notification of state changes (may affect look (view) and feel (controller)) 4. Access to the model data 5. View forwards interactions to the controller 30
31 Model-View-Controller (MVC) Patterns Observer Model = Observable View / Controller = Observers Information of the views and the controller about state changes Strategy Controller represents the behavior of the view. The behavior can be exchanged by replacing the strategy 31
32 Model-View-Controller (MVC) MVC Model 2 MVC adapted for use with the internet Client HTTP Request Servlet / Controller forward Operation data Model HTTP Response JSP / View Data request View is not registered as an observer in the model, it is informed about state changes from the controller 32
33 Outline Composite Pattern Model-View-Controller Pattern Callback Pattern 33
34 Interface / Callback Pattern Motivation How can the rectangle tool write into the status field? 34
35 Interface / Callback Pattern Structure in JDraw JTextField could be declared as a static reference Does not work with multiple views JTextField could be declared as a field in the StdDrawView class Too tight coupling, tool would only work with that particular implementation, could e.g. not be embedded in a browser (browser status field) 35
36 Interface / Callback Pattern Solution Definition of a callback interface DrawTool becomes independent of the concrete implementation Callback is registered in the using component over its constructor with a setcallback(callback cb) method 36
37 Interface / Callback Pattern Tight Coupling Client Service Independence through layering Client Service Impl Callback 37
2.1 Design Patterns and Architecture (continued)
MBSE - 2.1 Design Patterns and Architecture 1 2.1 Design Patterns and Architecture (continued) 1. Introduction 2. Model Construction 2.1 Design Patterns and Architecture 2.2 State Machines 2.3 Timed Automata
More information2.1 Design Patterns and Architecture (continued)
MBSE - 2.1 Design Patterns and Architecture 1 2.1 Design Patterns and Architecture (continued) 1. Introduction 2. Model Construction 2.1 Design Patterns and Architecture 2.2 State Machines 2.3 Abstract
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Composite 1 Composite pattern Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects
More informationOverview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008
Overview Lecture 7: Inheritance and GUIs Written by: Daniel Dalevi Inheritance Subclasses and superclasses Java keywords Interfaces and inheritance The JComponent class Casting The cosmic superclass Object
More informationThe Composite Pattern
The Composite Pattern Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. This is called
More informationObject-Oriented Oriented Programming
Object-Oriented Oriented Programming Composite Pattern CSIE Department, NTUT Woei-Kae Chen Catalog of Design patterns Creational patterns Abstract Factory, Builder, Factory Method, Prototype, Singleton
More informationIntroduction to GUIs. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2014
Introduction to GUIs Principles of Software Construction: Objects, Design, and Concurrency Jonathan Aldrich and Charlie Garrod Fall 2014 Slides copyright 2014 by Jonathan Aldrich, Charlie Garrod, Christian
More informationIntroduction to Graphical Interface Programming in Java. Introduction to AWT and Swing
Introduction to Graphical Interface Programming in Java Introduction to AWT and Swing GUI versus Graphics Programming Graphical User Interface (GUI) Graphics Programming Purpose is to display info and
More informationIntroduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of
Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of Computer Science Technische Universität Darmstadt Dr.
More informationThe Composite Design Pattern
Dr. Michael Eichberg Software Technology Group Department of Computer Science Technische Universität Darmstadt Introduction to Software Engineering The Composite Design Pattern For details see Gamma et
More informationUI Software Organization
UI Software Organization The user interface From previous class: Generally want to think of the UI as only one component of the system Deals with the user Separate from the functional core (AKA, the app
More informationDesign Pattern: Composite
Design Pattern: Composite Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. Motivation
More informationGraphical User Interface (GUI)
Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware
More informationLab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in
Lab 4 D0010E Object-Oriented Programming and Design Lecture 9 Lab 4: You will implement a game that can be played over the Internet. The networking part has already been written. Among other things, the
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 informationOutline. Inheritance. Abstract Classes Interfaces. Class Extension Overriding Methods Inheritance and Constructors Polymorphism.
Outline Inheritance Class Extension Overriding Methods Inheritance and Constructors Polymorphism Abstract Classes Interfaces 1 OOP Principles Encapsulation Methods and data are combined in classes Not
More informationDesign Patterns. Definition of a Design Pattern
Design Patterns Barbara Russo Definition of a Design Pattern A Pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem,
More informationBasics of programming 3. Java GUI and SWING
Basics of programming 3 Java GUI and SWING Complex widgets Basics of programming 3 BME IIT, Goldschmidt Balázs 2 Complex widgets JList elements can be selected from a list JComboBox drop down list with
More informationIntroduction to concurrency and GUIs
Principles of Software Construction: Objects, Design, and Concurrency Part 2: Designing (Sub)systems Introduction to concurrency and GUIs Charlie Garrod Bogdan Vasilescu School of Computer Science 1 Administrivia
More informationGUI Software Architecture
GUI Software Architecture P2: Requirements Analysis User Analysis Task Analysis Problem Scenarios Usability Criteria Scenario Your engineers just developed a new desktop computer. They give you the following
More informationLayout. Dynamic layout, Swing and general layout strategies
Layout Dynamic layout, Swing and general layout strategies Two Interface Layout Tasks Designing a spatial layout of widgets in a container Adjusting that spatial layout when container is resized Both
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 informationScene Graphs. COMP 575/770 Fall 2010
Scene Graphs COMP 575/770 Fall 2010 1 Data structures with transforms Representing a drawing ( scene ) List of objects Transform for each object can use minimal primitives: ellipse is transformed circle
More informationWe are on the GUI fast track path
We are on the GUI fast track path Chapter 13: Exception Handling Skip for now Chapter 14: Abstract Classes and Interfaces Sections 1 9: ActionListener interface Chapter 15: Graphics Skip for now Chapter
More informationJava Swing. Lists Trees Tables Styled Text Components Progress Indicators Component Organizers
Course Name: Advanced Java Lecture 19 Topics to be covered Java Swing Lists Trees Tables Styled Text Components Progress Indicators Component Organizers AWT to Swing AWT: Abstract Windowing Toolkit import
More informationLecture 9. Lecture
Layout Components MVC Design PaCern GUI Programming Observer Design PaCern D0010E Lecture 8 - Håkan Jonsson 1 Lecture 8 - Håkan Jonsson 2 Lecture 8 - Håkan Jonsson 3 1 1. GUI programming In the beginning,
More informationProduced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar
Design Patterns MSc in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie
More informationGraphics. Lecture 18 COP 3252 Summer June 6, 2017
Graphics Lecture 18 COP 3252 Summer 2017 June 6, 2017 Graphics classes In the original version of Java, graphics components were in the AWT library (Abstract Windows Toolkit) Was okay for developing simple
More informationGraphical User Interfaces. Swing. Jose Jesus García Rueda
Graphical User Interfaces. Swing Jose Jesus García Rueda Introduction What are the GUIs? Well known examples Basic concepts Graphical application. Containers. Actions. Events. Graphical elements: Menu
More informationCS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name:
CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, 2017 Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : If a child overrides
More informationThe JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class
CHAPTER GRAPHICAL USER INTERFACES 10 Slides by Donald W. Smith TechNeTrain.com Final Draft 10/30/11 10.1 Frame Windows Java provides classes to create graphical applications that can run on any major graphical
More informationGraphical User Interface (GUI)
Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware
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 informationJonathan Aldrich Charlie Garrod
Principles of Software Construction: Objects, Design, and Concurrency (Part 3: Design Case Studies) Introduction to GUIs Jonathan Aldrich Charlie Garrod School of Computer Science 1 Administrivia Homework
More informationLast Lecture. Lecture 17: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 4448/ Spring Semester, 2005
1 Lecture 17: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 4448/6448 - Spring Semester, 2005 2 Last Lecture Design Patterns Background and Core Concepts Examples
More informationFirst Name: AITI 2004: Exam 2 July 19, 2004
First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: JSP Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand
More informationSwing. By Iqtidar Ali
Swing By Iqtidar Ali Background of Swing We have been looking at AWT (Abstract Window ToolKit) components up till now. Programmers were not comfortable when doing programming with AWT. Bcoz AWT is limited
More informationConsiderations. New components can easily be added to a design.
Composite Pattern Facilitates the composition of objects into tree structures that represent part-whole hierarchies. These hierarchies consist of both primitive and composite objects. Considerations Clients
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 informationMODEL UPDATES MANIPULATES USER
1) What do you mean by MVC architecture? Explain its role in modern applications and list its advantages(may-2013,jan-2013,nov-2011). In addition to dividing the application into three kinds of components,
More informationDesign Patterns. Decorator. Oliver Haase
Design Patterns Decorator Oliver Haase 1 Motivation Your task is to program a coffee machine. The machine brews plain coffee, coffee with cream, sugar, sweetener, and cinnamon. A plain coffee costs 0,90,
More informationTopics in Object-Oriented Design Patterns
Software design Topics in Object-Oriented Design Patterns Material mainly from the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides; slides originally by Spiros Mancoridis;
More informationCS 2340 Objects and Design
CS 2340 Objects and Design Structural Patterns Christopher Simpkins chris.simpkins@gatech.edu Chris Simpkins (Georgia Tech) CS 2340 Objects and Design Structural Patterns 1 / 10 Structural Design Patterns
More informationLecture 5: Java Graphics
Lecture 5: Java Graphics CS 62 Spring 2019 William Devanny & Alexandra Papoutsaki 1 New Unit Overview Graphical User Interfaces (GUI) Components, e.g., JButton, JTextField, JSlider, JChooser, Containers,
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 informationCOSC 3351 Software Design. Design Patterns Structural Patterns (I)
COSC 3351 Software Design Design Patterns Structural Patterns (I) Spring 2008 Purpose Creational Structural Behavioral Scope Class Factory Method Adaptor(class) Interpreter Template Method Object Abstract
More information2110: GUIS: Graphical User Interfaces
2110: GUIS: Graphical User Interfaces Their mouse had a mean time between failure of a week it would jam up irreparably, or... jam up on the table--... It had a flimsy cord whose wires would break. Steve
More informationObject Design II: Design Patterns
Object-Oriented Software Engineering Using UML, Patterns, and Java Object Design II: Design Patterns Bernd Bruegge Applied Software Engineering Technische Universitaet Muenchen A Game: Get-15 The game
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 informationDesign Patterns IV. Alexei Khorev. 1 Structural Patterns. Structural Patterns. 2 Adapter Design Patterns IV. Alexei Khorev. Structural Patterns
Structural Design Patterns, 1 1 COMP2110/2510 Software Design Software Design for SE September 17, 2008 2 3 Department of Computer Science The Australian National University 4 18.1 18.2 GoF Structural
More informationJava: Graphical User Interfaces (GUI)
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, and Bertrand Meyer Java: Graphical User Interfaces (GUI) With material from Christoph Angerer The essence of the Java Graphics API Application
More informationCISC 322 Software Architecture
CISC 322 Software Architecture Lecture 14: Design Patterns Emad Shihab Material drawn from [Gamma95, Coplien95] Slides adapted from Spiros Mancoridis and Ahmed E. Hassan Motivation Good designers know
More informationDesign Patterns IV Structural Design Patterns, 1
Structural Design Patterns, 1 COMP2110/2510 Software Design Software Design for SE September 17, 2008 Class Object Department of Computer Science The Australian National University 18.1 1 2 Class Object
More informationIntroduction and History
Pieter van den Hombergh Fontys Hogeschool voor Techniek en Logistiek September 15, 2016 Content /FHTenL September 15, 2016 2/28 The idea is quite old, although rather young in SE. Keep up a roof. /FHTenL
More informationSDC Design patterns GoF
SDC Design patterns GoF Design Patterns The design pattern concept can be viewed as an abstraction of imitating useful parts of other software products. The design pattern is a description of communicating
More informationChapter 12 GUI Basics
Chapter 12 GUI Basics 1 Creating GUI Objects // Create a button with text OK JButton jbtok = new JButton("OK"); // Create a label with text "Enter your name: " JLabel jlblname = new JLabel("Enter your
More informationMultiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)
M257 MTA Spring2010 Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) 1. If we need various objects that are similar in structure, but
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 informationTool Kits, Swing. Overview. SMD158 Interactive Systems Spring Tool Kits in the Abstract. An overview of Swing/AWT
INSTITUTIONEN FÖR Tool Kits, Swing SMD158 Interactive Systems Spring 2005 Jan-28-05 2002-2005 by David A. Carr 1 L Overview Tool kits in the abstract An overview of Swing/AWT Jan-28-05 2002-2005 by David
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 informationCS 1316 Exam 3 Fall 2009
1 / 8 Your Name: I commit to uphold the ideals of honor and integrity by refusing to betray the trust bestowed upon me as a member of the Georgia Tech community. CS 1316 Exam 3 Fall 2009 Section/Problem
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 informationObject-Oriented Programming Design. Topic : Graphics Programming GUI Part I
Electrical and Computer Engineering Object-Oriented Topic : Graphics GUI Part I Maj Joel Young Joel.Young@afit.edu 15-Sep-03 Maj Joel Young A Brief History Lesson AWT Abstract Window Toolkit Implemented
More informationLecture 18 Java Graphics and GUIs
CSE 331 Software Design and Implementation The plan Today: introduction to Java graphics and Swing/AWT libraries Then: event-driven programming and user interaction Lecture 18 Java Graphics and GUIs None
More informationThis page intentionally left blank
This page intentionally left blank arting Out with Java: From Control Structures through Objects International Edition - PDF - PDF - PDF Cover Contents Preface Chapter 1 Introduction to Computers and Java
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 Lecturer: Michael Hotan slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer,
More informationDr. Hikmat A. M. AbdelJaber
Dr. Hikmat A. M. AbdelJaber JWindow: is a window without a title bar or move controls. The program can move and resize it, but the user cannot. It has no border at all. It optionally has a parent JFrame.
More informationCS410G: GUI Programming. The Model/View/Controller Pattern. Model. Controller. View. MVC is a popular architecture for building GUIs
CS410G: GUI Programming The Model/View/Controller design pattern provides a clean distinction between the your application s data (model), your GUI (view), and the how they interact (controller). Many
More informationTransformation Hierarchies. CS 4620 Lecture 5
Transformation Hierarchies CS 4620 Lecture 5 2013 Steve Marschner 1 Data structures with transforms Representing a drawing ( scene ) List of objects Transform for each object can use minimal primitives:
More informationComposite Pattern - Shapes Example - Java Sourcecode
Composite Pattern - Shapes Example - Java Sourcecode In graphics editors a shape can be basic or complex. An example of a simple shape is a line, where a complex shape is a rectangle which is made of four
More informationDesign Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester
Design Patterns Comp2110 Software Design Department of Computer Science Australian National University Second Semester 2005 1 Design Pattern Space Creational patterns Deal with initializing and configuring
More informationInheritance. OOP: Inheritance 1
Inheritance Reuse Extension and intension Class specialization and class extension Inheritance The protected keyword revisited Inheritance and methods Method redefinition An widely used inheritance example
More informationGenerative Design Patterns
Generative Design Patterns S. MacDonald, D. Szafron, J. Schaeffer, J. Anvik, S. Bromling and K. Tan Department of Computing Science, University of Alberta, Edmonton, AB T6G 2H1, Canada {stevem, duane,
More informationTopic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more
Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"
More informationTopic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!
Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques
More informationInheritance. One class inherits from another if it describes a specialized subset of objects Terminology:
Inheritance 1 Inheritance One class inherits from another if it describes a specialized subset of objects Terminology: the class that inherits is called a child class or subclass the class that is inherited
More informationWelcome to CIS 068! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) CIS 068
Welcome to! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) Overview JAVA and GUIs: SWING Container, Components, Layouts Using SWING Streams and Files Text
More informationCS 11 java track: lecture 3
CS 11 java track: lecture 3 This week: documentation (javadoc) exception handling more on object-oriented programming (OOP) inheritance and polymorphism abstract classes and interfaces graphical user interfaces
More informationLecture 36: Cloning. Last time: Today: 1. Object 2. Polymorphism and abstract methods 3. Upcasting / downcasting
Lecture 36: Cloning Last time: 1. Object 2. Polymorphism and abstract methods 3. Upcasting / downcasting Today: 1. Project #7 assigned 2. equals reconsidered 3. Copying and cloning 4. Composition 11/27/2006
More informationCSE 331 Software Design & Implementation
CSE 331 Software Design & Implementation Hal Perkins Winter 2018 Java Graphics and GUIs 1 The plan Today: introduction to Java graphics and Swing/AWT libraries Then: event-driven programming and user interaction
More informationStatic Detection of Brittle Parameter Typing
Static Detection of Brittle Parameter Typing Michael Pradel, Severin Heiniger, and Thomas R. Gross Department of Computer Science ETH Zurich 1 Motivation void m(a a) {... } Object A.. B C D E F 2 Motivation
More informationAn Introduction to Patterns
An Introduction to Patterns Robert B. France Colorado State University Robert B. France 1 What is a Pattern? - 1 Work on software development patterns stemmed from work on patterns from building architecture
More informationStarting Out with Java: From Control Structures Through Objects Sixth Edition
Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes
More informationMore on inheritance CSCI 136: Fundamentals of Computer Science II Keith Vertanen Copyright 2014
More on inheritance CSCI 136: Fundamentals of Computer Science II Keith Vertanen Copyright 2014 Object hierarchies Overview Several classes inheriting from same base class Concrete versus abstract classes
More informationJava Object Oriented Design. CSC207 Fall 2014
Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code
More informationLast Lecture. Lecture 26: Design Patterns (part 2) State. Goals of Lecture. Design Patterns
Lecture 26: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Last Lecture Design Patterns Background and Core Concepts Examples Singleton,
More informationComposite Pattern. IV.4 Structural Pattern
IV.4 Structural Pattern Motivation: Compose objects to realize new functionality Flexible structures that can be changed at run-time Problems: Fixed class for every composition is required at compile-time
More informationGoals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords
Goals By the end of this lesson, you should: Lecture 7 More GUI programming 1. Be able to write Java s with JTextField, JList, JCheckBox and JRadioButton components 2. Be able to implement a ButtonGroup
More informationCS 251 Intermediate Programming GUIs: Components and Layout
CS 251 Intermediate Programming GUIs: Components and Layout Brooke Chenoweth University of New Mexico Fall 2017 import javax. swing.*; Hello GUI public class HelloGUI extends JFrame { public HelloGUI ()
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 informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Composite 1 Composite pattern Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects
More informationAssertions, pre/postconditions
Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What
More informationDesign Patterns in C++
Design Patterns in C++ Structural Patterns Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa March 23, 2011 G. Lipari (Scuola Superiore Sant Anna) Structural patterns March
More informationAssignment 2. Application Development
Application Development Assignment 2 Content Application Development Day 2 Lecture The lecture covers the key language elements of the Java programming language. You are introduced to numerical data and
More informationCSE 70 Final Exam Fall 2009
Signature cs70f Name Student ID CSE 70 Final Exam Fall 2009 Page 1 (10 points) Page 2 (16 points) Page 3 (22 points) Page 4 (13 points) Page 5 (15 points) Page 6 (20 points) Page 7 (9 points) Page 8 (15
More informationWeek Chapter Assignment SD Technology Standards. 1,2, Review Knowledge Check JP3.1. Program 5.1. Program 5.1. Program 5.2. Program 5.2. Program 5.
Week Chapter Assignment SD Technology Standards 1,2, Review JP3.1 Review exercises Debugging Exercises 3,4 Arrays, loops and layout managers. (5) Create and implement an external class Write code to create
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 informationGraphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI
CBOP3203 Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI components like button, text input, scroll bar and others.
More informationFirst Name: AITI 2004: Exam 2 July 19, 2004
First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: Standard Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand
More informationInheritance and Substitution (Budd chapter 8, 10)
Inheritance and Substitution (Budd chapter 8, 10) 1 2 Plan The meaning of inheritance The syntax used to describe inheritance and overriding The idea of substitution of a child class for a parent The various
More information