Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 1030: Implementing GUI Mark Shtern.

Similar presentations


Presentation on theme: "CSE 1030: Implementing GUI Mark Shtern."— Presentation transcript:

1 CSE 1030: Implementing GUI Mark Shtern

2 Summary Implementation of Inheritance Custom Exceptions

3 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

4 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

5 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

6 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.

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

8 GUI

9 MVC

10 Our goal

11 High-Level Design

12 View

13 View

14 JMenuBar

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

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

17 Dynamic Menu Print Selection

18 Controller

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

20 Shuffle

21 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

22 Custom Shape


Download ppt "CSE 1030: Implementing GUI Mark Shtern."

Similar presentations


Ads by Google