Add Observer and Observable implementation
Add update method, notifyForUpdates methods Currently not working
This commit is contained in:
1 parent
892d7e6ff3
commit
f8623fdd7a
13 files changed
+165
-14
No files matched your search
@@ -2,6 +2,8 @@ package ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public abstract class DrawingBox extends JPanel {
|
||||
@@ -17,4 +19,16 @@ public abstract class DrawingBox extends JPanel {
|
||||
setBackground(color);
|
||||
setPreferredSize(new Dimension(40,40));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
|
||||
super.paintComponent(g) ;
|
||||
setBackground(color);
|
||||
}
|
||||
|
||||
public void notifyForUpdates(Object param) {
|
||||
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user