Object Oriented Programming Lecture 3: Things OO.

Slides:



Advertisements
Similar presentations
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Advertisements

Made with love, by Zachary Langley Applets The Graphics Presentation.
Chapter 13 – Introduction to Classes
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
L3:CSC © Dr. Basheer M. Nasef Lecture #3 By Dr. Basheer M. Nasef.
1 Drawing C Sc 335 Object-Oriented Programming and Design Rick Mercer.
Chapter 4 (Horstmann’s Book) Interface Types and Polymorphism: Graphics, Timer, Animation Hwajung Lee.
Graphical User Interface Bonus slides Interaction Between Components & Drawing.
1 Chapter 8 Objects and Classes Lecture 2 Prepared by Muhanad Alkhalisy.
Chapter 14 Graph class design John Keyser’s Modifications of Slides by Bjarne Stroustrup
Lecture 10: Part 1: OO Issues CS 540 George Mason University.
Introduction to Java Classes, events, GUI’s. Understand: How to use TextPad How to define a class or object How to create a GUI interface How event-driven.
1 G54PRG Programming Lecture 1 Amadeo Ascó Adam Moore 20 Object Oriented Theory II.
Lecture 28: Abstract Classes & Inheritance Announcements & Review Lab 8 Due Thursday Image and color effects with 2D arrays Read: –Chapter 9 Cahoon & Davidson.
Faculty of Sciences and Social Sciences HOPE Structured Problem Solving Object Oriented Concepts 2 Stewart Blakeway FML 213
 Next - Previous  Horizontal Bar  Vertical Menu.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
1 Chapter 1 Object-Oriented Programming. 2 OO programming and design Object-oriented programming and design can be contrasted with alternative programming.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Topics  Applets  Classes used for graphics Graphics Point Dimension.
Basic OOP Concepts and Terms
ObjectDraw and Objects Early Chris Nevison Barbara Wells.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 5 Java Graphics Applets.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 5 Applets and Graphics.
CS 2511 Fall Features of Object Oriented Technology  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance.
UML Basics & Access Modifier
Object Oriented Programming Lecture 5: BallWorld.
Lecture 15: Intro to Graphics Yoni Fridman 7/25/01 7/25/01.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
Session 16 Pinball Game Construction Kit:. Pinball Version 1 Replaced the fire button with a mouse event. Multiple balls can be in the air at once. –Uses.
Tkinter Canvas.
Chapter FifteenModern Programming Languages1 A Second Look At Java.
Session 13 Pinball Game Construction Kit (Version 3):
1 OOP - An Introduction ISQS 6337 John R. Durrett.
Lecture 26: Inheritance Announcements & Review Lab 8 Due Thursday Image and color effects with 2D arrays Last Time Images as 2D arrays color representation.
CSci 162 Lecture 10 Martin van Bommel. Procedures vs Objects Procedural Programming –Centered on the procedures or actions that take place in a program.
Layout How multiple components are composed to build interfaces.
Java Programming: From Problem Analysis to Program Design, Second Edition1 Lecture 5 Objectives  Learn about basic GUI components.  Explore how the GUI.
Classes Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Arithmetic, Class Variables and Class Methods Week 11
CS 151: Object-Oriented Design October 1 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
Microsoft® Small Basic Exploring Shapes Estimated time to complete this lesson: 1 hour.
Starting Out With Java 5 Control Structures to Objects By Tony Gaddis Copyright © 2005, 2005 Pearson Addison-Wesley. All rights reserved. Chapter 6 Slide.
IAT 265 Images in Processing PImage. Jun 27, 2014IAT 2652 Outline  Programming concepts –Classes –PImage –PFont.
1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
1 A field is enclosed by a rectangular fence 50m by 20m. It is changed so the fence is now a square. By how much has the area increased?
CS16: UML’s Unified Modeling Language. UML Class Diagram A UML class diagram is a graphical tool that can aid in the design of a class. The diagram has.
3D Technologies for the Web
Classes and OOP.
A first Look at Classes.
Web Games Programming Creating Split-View Cameras and Camera Overlays.
CompSci 230 S Programming Techniques
Chapter 4 Interface Types and Polymorphism Part 1
Example: Card Game Create a class called “Card”
Java Programming: From Problem Analysis to Program Design,
Introduction to Object-oriented Program Design
Chapter 14 JavaFX Basics Dr. Clincy - Lecture.
Basic Graphics Drawing Shapes 1.
Classes & Objects CSCE 121 J. Michael Moore.
Implementing Non-Static Features
Interfaces, Classes & Objects
Basic OOP Concepts and Terms
Defining Classes and Methods
CiS 260: App Dev I Chapter 6: GUI and OOD.
Expanding the PinBallGame
Chapter 4 Interface Types and Polymorphism Part 1
CSG2H3 Object Oriented Programming
Presentation transcript:

Object Oriented Programming Lecture 3: Things OO

Jargon Class / Instance Multiple instances of a Class Data fields Methods

Class & Instance Analogous to Type & Variable Example – Just for design purposes (not AWT) – Rectangle Used in graphics programming for size of Window or enclosing area for text or image In creating a window – CreateWindow(…, 100, 100, 300, 500, …); – CreateWindow(…, top, right, width, height, …);

Class & Instance Analogous to Type & Variable Example – Just for design purposes (not AWT) – Rectangle Used in graphics programming for size of Window or enclosing area for text or image In creating a window – CreateWindow(…, 100, 100, 300, 500, …); – CreateWindow(…, top, right, width, height, …); – CreateWindow(…, winrect, …);

Class & Instance Analogous to Type & Variable Example – Just for design purposes (not AWT) – Rectangle Used in graphics programming for size of Window or enclosing area for text or image In creating a window – CreateWindow(…, 100, 100, 300, 500, …); – CreateWindow(…, top, right, width, height, …); – Rectangle winrect; – winrect.top = 100; winrect.right = 100; …. – CreateWindow(…, winrect, …); – PAYOFF ???????

Class & Instance Analogous to Type & Variable Example – Just for design purposes (not AWT) – Rectangle Used in graphics programming for size of Window or enclosing area for text or image In creating a window – CreateWindow(…, 100, 100, 300, 500, …); – CreateWindow(…, top, right, width, height, …); – Rectangle winrect(100, 100, 300, 500); – CreateWindow(…, winrect, …); – CreateWindow(…, Rectangle(100, 100, 300, 500), …); – PAYOFF ???????

Rectangle Actions What might we want to do with rectangles? – Specify a size and location (window, …) – Eg: text area – Combine, scale, centre, intersect – Eg: size and centre a window, text

Rectangle Storage How do we represent a rectangle position and size or four corners

OO Group data together (struct) Encapsulate (private components) – Implementation hiding – Separate interface from implementation

OO Rectangle class Rectangle { private: int top, left, bottom, right; public: int getWidth() { return right – left + 1; } }

Demonstration J02 program – Shows how to use a Frame from Java AWT to open a window