1 package fi.jyu.mit.graphics;
2
3 import java.awt.BorderLayout;
4
5 import javax.swing.JFrame;
6
7
12 public class ControllerFrame extends JFrame implements ObjectController {
13
14 private static final long serialVersionUID = 1L;
15
16 private BasicController controller;
17
18
22 public ControllerFrame(BasicController controller){
23 super();
24 this.controller = controller;
25 getContentPane().setLayout(new BorderLayout());
26 getContentPane().add(controller);
27 }
28
29
37 public ControllerFrame(BasicController controller,int x,int y, int w, int h){
38 this(controller);
39 setBounds(x,y,w,h);
40 showController();
41 }
42
43 public BasicController getController() {
44 return controller;
45 }
46
47 @Override
48 public void setObject(Transformable object) {
49 controller.setObject(object);
50 }
51
52 @Override
53 public Transformable getObject() {
54 return controller.getObject();
55 }
56
57 @Override
58 public final void showController() {
59 this.setVisible(true);
60 }
61
62 @Override
63 public void hideController() {
64 this.setVisible(false);
65 }
66
67 }
68