Package observer
Class DrawingObserver
- java.lang.Object
-
- observer.DrawingObserver
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
public class DrawingObserver extends java.lang.Object implements java.beans.PropertyChangeListener
-
-
Field Summary
Fields Modifier and Type Field Description (package private) DrawingFrame
frame
-
Constructor Summary
Constructors Constructor Description DrawingObserver(DrawingFrame frame)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(javax.swing.JButton button, java.awt.event.MouseAdapter adapter)
Method that add listener to some button and enable it.void
propertyChange(java.beans.PropertyChangeEvent evt)
Listen to changes fromDrawingModel
that sends Subject -DrawingController
to update buttons depend on state of draw inDrawingFrame
.void
removeListener(javax.swing.JButton button, java.awt.event.MouseAdapter adapter)
Method that remove listener from some button and disable it.
-
-
-
Field Detail
-
frame
DrawingFrame frame
-
-
Constructor Detail
-
DrawingObserver
public DrawingObserver(DrawingFrame frame)
-
-
Method Detail
-
addListener
public void addListener(javax.swing.JButton button, java.awt.event.MouseAdapter adapter)
Method that add listener to some button and enable it.- Parameters:
button
- Represent button which need to be updated.adapter
- Represent adapter for that button.
-
removeListener
public void removeListener(javax.swing.JButton button, java.awt.event.MouseAdapter adapter)
Method that remove listener from some button and disable it.- Parameters:
button
- Represent button which need to be updated.adapter
- Represent adapter for that button.
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
Listen to changes fromDrawingModel
that sends Subject -DrawingController
to update buttons depend on state of draw inDrawingFrame
.- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
-