Mercurial > hg > mep
diff ExperimentGui.java @ 23:9fc8683b8fed
Fixed GUI button presses, had their background change as feedback and added ability to record responses for a probe tone at the end of a sequence
author | JShulver |
---|---|
date | Wed, 07 Nov 2012 18:22:01 +0000 |
parents | 3dd7636ca811 |
children | c5db34797ff3 |
line wrap: on
line diff
--- a/ExperimentGui.java Wed Oct 31 15:16:26 2012 +0000 +++ b/ExperimentGui.java Wed Nov 07 18:22:01 2012 +0000 @@ -33,7 +33,7 @@ public Boolean getAcceptingResponses() { return acceptingResponses; } public void setAcceptingResponses(Boolean b) { if (exp.getDebug()) - System.out.println("Changing acceptingResponses from " + acceptingResponses + " to " + b); + System.out.println("\n\nChanging acceptingResponses from " + acceptingResponses + " to " + b); acceptingResponses = b; } public Experiment getExperiment() { return exp; } @@ -109,7 +109,7 @@ /* Show the Fixation Point */ public void showFixationPoint() { - //System.out.println("showFixationPoint"); + System.out.println("showFixationPoint"); clock.showClock = false; clock.showFullClock = false; clock.repaint(); @@ -130,9 +130,10 @@ showFixationPoint(); } + /* Run method for this thread */ public void run() { - + System.out.println("Run!"); //showFixationPoint(); clock.reset(); showClock(); @@ -160,7 +161,10 @@ int clockUnit = 0; boolean clockTicking = false; - while(oi.hasNext()) { + do { //using a do-while construct allows the user to enter a value at the end + //this should not really be in the 'view' anyway... + System.out.println("TATUM: " +tatum); + tatumInMilliseconds = tatum/1000; if (exp.getDebug()) System.out.println("Ticking = " + clockTicking + "; clockUnit = " + clockUnit + @@ -171,16 +175,18 @@ if (clockTicking == true && clockUnit == 0) tick(nMinutes); - if (currentOnset == nextClockStartTime) { + if (currentOnset >= nextClockStartTime) { //new Thread(clock).start(); clock.reset(); showClock(); clockTicking = true; if (ci.hasNext()) nextClockStartTime = ((Long)(ci.next())).longValue(); + else + nextClockStartTime = Long.MAX_VALUE; } - - if (currentOnset == nextEventOnset) { + if (currentOnset >= nextEventOnset) { + probe = (ProbeID)pi.next(); // Manipulate display depending on probe identifier switch (probe) { case NOT_PROBE: @@ -222,17 +228,17 @@ break; } // Update probe identifier and onset - probe = (ProbeID)pi.next(); + if (exp.getDebug()) System.out.println("Next probe = " + probe); nextEventOnset =((Long)(oi.next())).longValue(); - } + } // sleep for a tatum try { Thread.sleep(tatumInMilliseconds); } catch (InterruptedException e) {} currentOnset += tatum; clockUnit = (clockUnit + 1) % clockUnits; - } + } while(oi.hasNext()); showFixationPoint(); } }