From 8eae404e2b1d0741d9536c8e55fc78c342df1a15 Mon Sep 17 00:00:00 2001 From: rmh3093 Date: Tue, 16 Sep 2008 15:46:06 -0400 Subject: [PATCH] some fixes --- motsim/ControlPanel.java | 2 +- motsim/Controller.java | 4 +++- motsim/Trial.java | 15 ++++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/motsim/ControlPanel.java b/motsim/ControlPanel.java index d7ab053..440371d 100644 --- a/motsim/ControlPanel.java +++ b/motsim/ControlPanel.java @@ -137,7 +137,7 @@ class ControlPanel extends JFrame implements ActionListener { options_panel.add(speed_spinner); duration_label = new JLabel("Trial duration (seconds): "); duration_spinner = - new JSpinner(new SpinnerNumberModel(2, 1, 300, 1)); + new JSpinner(new SpinnerNumberModel(5, 1, 300, 1)); duration_spinner.setFocusable(false); options_panel.add(duration_label); options_panel.add(duration_spinner); diff --git a/motsim/Controller.java b/motsim/Controller.java index 3b5ef09..5b47b8e 100755 --- a/motsim/Controller.java +++ b/motsim/Controller.java @@ -212,7 +212,9 @@ public class Controller implements Runnable { model.stage = Model.TrialStage.WAIT; } else { model.trialCount++; - model.stage = Model.TrialStage.START_TRIAL; + view.trial.clearScreen(); + view.trial.setupTrial(); + model.stage = Model.TrialStage.GENERATE_TARGETS; } break; } diff --git a/motsim/Trial.java b/motsim/Trial.java index 3c6386e..ac46a5f 100644 --- a/motsim/Trial.java +++ b/motsim/Trial.java @@ -70,8 +70,13 @@ class Trial extends JFrame { offscreen = createImage(screen_size.width, screen_size.height); bufferGraphics = (Graphics2D)offscreen.getGraphics(); frc = bufferGraphics.getFontRenderContext(); + setupTrial(); + } + + public void setupTrial() { model.startTime = 0; model.stopTime = 0; + model.duration = 0; } private void drawTarget(Target t, boolean isMasked) { @@ -112,7 +117,7 @@ class Trial extends JFrame { (model.mouse_y_clk<=t.y) ) { if (model.targets.get(model.target)==t) { model.stage = Model.TrialStage.STOP_SEARCH; - stopTrial(); + //stopTrial(); } } @@ -168,8 +173,7 @@ class Trial extends JFrame { if ((model.stage.ordinal() == Model.TrialStage.MOVE_TARGETS.ordinal()) || model.stage.ordinal() == Model.TrialStage.FIND_TARGET.ordinal() ) { - bufferGraphics.clearRect(0, 0, screen_size.width, - screen_size.height); + clearScreen(); drawFrame(); if (model.stage == Model.TrialStage.FIND_TARGET) drawQuery(); @@ -182,6 +186,11 @@ class Trial extends JFrame { paint(g); } + public void clearScreen() { + bufferGraphics.clearRect(0, 0, screen_size.width, + screen_size.height); + } + protected void stopTrial() { setVisible(false); } -- 2.11.4.GIT