clean shit
[rmh3093.git] / motsim / View.java
blobe54f81cb234d4316d4f553b8c6459926b3b44b0e
1 /**
2 * MOTSIM_View.java
3 * motsim
4 */
6 /*
7 Copyright (c) 2008, Ryan M. Hope
8 All rights reserved.
10 Redistribution and use in source and binary forms, with or without modification,
11 are permitted provided that the following conditions are met:
13 * Redistributions of source code must retain the above copyright notice,
14 this list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
18 * Neither the name of the project nor the names of its contributors may be
19 used to endorse or promote products derived from this software without
20 specific prior written permission.
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
26 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 import java.awt.Dimension;
35 //import java.awt.DisplayMode;
36 import java.awt.GraphicsEnvironment;
37 import java.awt.Toolkit;
39 public class View {
41 Model model;
42 ControlPanel cp;
43 Trial trial;
44 Dimension screen_size;
45 EventHandler evh;
47 public View(Model model) {
48 this.model = model;
49 screen_size = Toolkit.getDefaultToolkit().getScreenSize();
50 model.ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
51 model.gd = model.ge.getDefaultScreenDevice();
54 public void setEventHandler(EventHandler evh) {
55 this.evh = evh;
58 public void startControlPanel() {
59 cp = new ControlPanel(evh);
62 public void startTrial() {
63 trial = new Trial(model, screen_size, evh);
66 public void collectDemographics() {
67 cp.config_panel.setVisible(false);
68 cp.sx_panel.setVisible(true);
69 cp.pack();