Doing MVC in Swing - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Doing MVC in Swing

Description:

Accessing a JComboBox's data model. Example 3. A JButton and ... Creating a custom TemparatureModel bridging different different models and UI components ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 12
Provided by: georgep3
Category:
Tags: mvc | custom | doing | swing

less

Transcript and Presenter's Notes

Title: Doing MVC in Swing


1
Swing Meets MVC
  • Doing MVC in Swing

2
Agenda
  • Questions

3
Swings modified MVC design
  • Separable model architecture
  • Model
  • treated as a separate element
  • View controller
  • Treated as a single UI
  • delegate

4
Example pieces in a JButton
5
Pluggable look-and-feel
  • Architecture separates the look-and-feel of a
    component
  • Different instances of the UI object provide a
    different look-and-feel
  • http//java.sun.com/products/jfc/tsc/articles/arch
    itecture/index.html

6
Model types
  • GUI-state models
  • visual status of a GUI component
  • example button is pressed
  • selected items in list
  • Application-data models
  • quantifiable data with application meanings
  • example cell values in table
  • items displayed in list

7
Common component-to-model mapping
8
Model change notification
  • Lightweight notification that the state of the
    component has changed and requires listeners to
    query the model about what changed
  • Stateful notification that describes how the
    model has changed

9
Examples of model change notifications
  • Lightweight notification
  • Stateful notification

10
Shared model definitions
  • Notice some components use the same model
    interfaces when data abstraction for component is
    similar
  • Common models enable
  • automatic connectability
  • between components

11
Examples
  • Example 1
  • GUI model controlling a JButton
  • Example 2
  • Accessing a JComboBoxs data model
  • Example 3
  • A JButton and JCheckBox sharing a model
  • Example 4
  • Creating a custom TemparatureModel bridging
    different different models and UI components
Write a Comment
User Comments (0)
About PowerShow.com