CSE 1030: Implementing GUI Mark Shtern.

Slides:



Advertisements
Similar presentations
Week 8 Recap CSE 115 Spring Composite Revisited Once we create a composite object, it can itself refer to composites. Once we create a composite.
Advertisements

Objectives Introduction to Inheritance and Composition (Subclasses and SuperClasses) Overriding (and extending), and inheriting methods and constructors.
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
Chapter 10: Introduction to Inheritance
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 Chapter 12 More OOP, Interfaces, and Inner Classes.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Encapsulation, Inheritance & Interfaces CSE 115 Spring 2006 February 27, March 1 & 3, 2006.
Slides prepared by Rose Williams, Binghamton University Chapter 13 Interfaces and Inner Classes.
Slides prepared by Rose Williams, Binghamton University Chapter 13 Interfaces and Inner Classes.
UML Class Diagram: class Rectangle
Chapter 10: Inheritance and Polymorphism
8.1 Classes & Inheritance Inheritance Objects are created to model ‘things’ Sometimes, ‘things’ may be different, but still have many attributes.
CMSC 202 Interfaces. 11/20102 Classes and Methods When a class defines its methods as public, it describes how the class user interacts with the method.
Inheritance using Java
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
Chapter 11 Inheritance and Composition. Chapter Objectives Learn about inheritance Learn about subclasses and superclasses Explore how to override the.
Chris Kiekintveld CS 2401 (Fall 2010) Elementary Data Structures and Algorithms Inheritance and Polymorphism.
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
Comp 249 Programming Methodology Chapter 13 Interfaces & Inner Classes Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Data Structures Using Java1 Chapter 2 Inheritance and Exception Handling.
CSE 341, S. Tanimoto Java brief review - 1 Java Brief Review Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Inheritance Objectives: Creating new classes from existing classes The protected modifier Creating class hierarchies Abstract classes Indirect visibility.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Java Programming: From Problem Analysis to Program Design, 3e Chapter 11 Inheritance and Polymorphism.
Interfaces An interface is like an extreme case of an abstract class – However, an interface is not a class – It is a type that can be satisfied by any.
Interfaces and Inner Classes
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
UNIT-3 Interfaces & Packages. What is an Interface? An interface is similar to an abstract class with the following exceptions: All methods defined in.
Chapter 13 Interfaces and Inner Classes Slides prepared by Rose Williams, Binghamton University Copyright © 2008 Pearson Addison-Wesley. All rights reserved.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
COP INTERMEDIATE JAVA Inheritance, Polymorphism, Interfaces.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 7 : Interfaces King Fahd University of Petroleum & Minerals College of Computer.
ISBN Chapter 12 Support for Object-Oriented Programming.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Java Interfaces CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University (see Chapter 9 of.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Sections Inheritance and Abstract Classes
Final and Abstract Classes
Inheritance and Polymorphism
Chapter 11: Inheritance and Polymorphism
UML Class Diagram: class Rectangle
Comp 249 Programming Methodology
Inheritance, Polymorphism, and Interfaces. Oh My
Chapter 4 Inheritance.
Inheritance Chapter 7 Chapter 7.
CMSC 202 Interfaces.
Java Programming Language
Inheritance, Polymorphism, and Interfaces. Oh My
Advanced Java Topics Chapter 9
Polymorphism CT1513.
Interfaces.
Advanced Java Programming
Summary Array List.
Interfaces and Inner Classes
Java Inheritance.
Object-Oriented Programming: Inheritance and Polymorphism
CMSC 202 Interfaces.
Fundaments of Game Design
Chapter 9 Carrano Chapter 10 Small Java
Chapter 14 Abstract Classes and Interfaces
Final and Abstract Classes
CMSC 202 Interfaces.
Extending Classes Through Inheritance
Chapter 8 Abstract Classes.
Presentation transcript:

CSE 1030: Implementing GUI Mark Shtern

Summary Implementation of Inheritance Custom Exceptions

Introduction to Abstract Classes In order to postpone the definition of a method, Java allows an abstract method to be declared An abstract method has a heading, but no method body The body of the method is defined in the derived classes The class that contains an abstract method is called an abstract class

Abstract Classes Use to declare common characteristics of subclasses Cannot be instantiated Declare with the abstract keyword Use as a superclass for other classes that extend the abstract class Abstract classes let you define some behaviours; they force your subclasses to provide others

Interfaces An interface is something like an extreme case of an abstract class However, an interface is not a class It is a type that can be satisfied by any class that implements the interface Examples: List, Set, Comparable The syntax for defining an interface is similar to that of defining a class Except the word interface is used in place of class An interface specifies a set of methods that any class that implements the interface must have It contains method headings and constant definitions only It contains no instance variables nor any complete method definitions

Interfaces An interface and all of its method headings should be declared public They cannot be given private When a class implements an interface, it must make all the methods in the interface public Because an interface is a type, a method may be written with a parameter of an interface type That parameter will accept as an argument any class that implements the interface Copyright © 2010 Pearson Addison-Wesley. All rights reserved.

Interfaces An interface serves a function similar to a base class, though it is not a base class A class may implement several interfaces

GUI

MVC

Our goal

High-Level Design

View

View

JMenuBar

Implementation Model View Controller Store titles Set title Load menu from model Controller

Implementation GUI Configure menu Create Model Create View Configure view Set size Set default close operation Make view visible

Dynamic Menu Print Selection

Controller

Implementation Controller Model View Event Handler Add menu selection method View Register controller for receiving menu selection event

Shuffle

Implementation View Controller Model Add button Register controller to receive click event from button Controller Modify handler to process button and menu events Model Add method for shuffling menu

Custom Shape