timer

Issue with TimerTask

蓝咒 提交于 2019-12-13 06:38:20
问题 Just have a look on this block of code: public Reminder() { a[0]=1000; a[1]=3000; a[2]=1000; a[3]=5000; timer = new Timer(); timer.schedule(new RemindTask(),0, a[i]); } ////////////////////// class RemindTask extends TimerTask { public void run() { point =point +arr[i].length(); doc.setCharacterAttributes(0,point+1, textpane.getStyle("Red"), true); i++; } } I want delay to be changed after each task,so the timings are stored in an array. When i++ is preformed(pointer to array),the timings are

Pipe Game - PipeObject in class PipeObject cannot be applied to given types

自古美人都是妖i 提交于 2019-12-13 06:26:45
问题 I keep getting the error "PipeObject in class PipeObject cannot be applied to given types" public Pipes() { pipes.add(new PipeObject(x1, y1)); pipes.add(new PipeObject(x1 + 200, y2)); pipes.add(new PipeObject(x1 + 400, y3)); } I have an object class that I want to be added to a JPanel by a class that controls the objects and draws 3 instances of it to the screen. It needs to be able to give different values to the object class. My third class is the main() class and should add the class with

How to display and compute time in java [closed]

*爱你&永不变心* 提交于 2019-12-13 06:26:34
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am building a java application.I need to monitor how long the user is staying on a particular page.The timer should start on user entering the page.It should pause on user moving away to another page and resumes when user returns to the "page(panel)".It should work like a stopwatch on a particular panel. 回答1:

How to Increment timer asynchronously ?

此生再无相见时 提交于 2019-12-13 06:20:47
问题 I am trying to Update a timer asynchronously On a Button Click . say example i have set the time = 60 seconds and when i run the program after few TIME the timer has reached to 45 seconds and when i click the Button ,then it should add j=15 seconds to the time and the timer should change to 60 seconds asynchronously. Please Help private int time = 60; DateTime dt = new DateTime(); private j = 15 ; private DispatcherTimer timer; public MainWindow() { InitializeComponent(); timer = new

How to take 30 screenshots in a second in an iOS device?

纵饮孤独 提交于 2019-12-13 06:12:19
问题 In my iOS app, I am using NSTime to invoke a method which takes screenshot of the device screen. I am taking 30 screenshots per second. On simulator its working fine (as the processor of Mac is far more powerful than iPad). But it takes less number of screenshots in actual device. How can I do this? Any reliable alternative for timer? Please help 来源: https://stackoverflow.com/questions/16982374/how-to-take-30-screenshots-in-a-second-in-an-ios-device

PyQt4 - timer.timeout.connect() - cannot find reference

本小妞迷上赌 提交于 2019-12-13 06:06:19
问题 from PyQt4 import QtGui, QtCore from code.pair import Pair from code.breadth_first_search import breadth_first_search import functools class Ghosts(QtGui.QGraphicsPixmapItem): def __init__(self, name): super(Ghosts, self).__init__() self.set_image(name) def chase(self, goal): pos = Pair(self.x(), self.y()) path = breadth_first_search(pos, goal) func = functools.partial(self.move_towards, path) timer = QtCore.QTimer() timer.timeout.connect(func) timer.start(700) def move_towards(self, path):

Matlab - updating objects on a plot

◇◆丶佛笑我妖孽 提交于 2019-12-13 05:52:08
问题 I am trying to add a timer a simulation i am working on. At the moment i can get the timer to display in the location i want, however i cant make the numbers clear each other, i.e they all just stack on top of each other slowly creating a solid black mess. I have tried implementing a clf function but it just clears the entire figure. The code for the timer is: HH = 0; MM = 0; SS = 0; timer = sprintf('%02d:%02d:%02d',HH,MM,SS); text(-450,450,timer); %% adjust location of clock in graph using

Android - Service: Repeats only once

Deadly 提交于 2019-12-13 05:50:06
问题 I have a problem with scheduleAtFixedRate. It will only called once and does not repeat. what is wrong? public class TimerService extends Service { static final int UPDATE_INTERVAL=3000; private Timer timer = new Timer(); private Date date; @Override public int onStartCommand(Intent intent, int flags, int startId) { repeatJob(); //Here we want this service to continue running until it is explicitly stopped, so return sticky return START_STICKY; } private void repeatJob() { timer

Handling timers in java

左心房为你撑大大i 提交于 2019-12-13 05:34:25
问题 I have an application which runs a timer to check for idle time and once there is no activity for 10 seconds the application will close. I have nearly 100 screens and i want to track the inactivity seconds on all the screens. Its hard for me to write the handling events in all buttons, textboxes, labelboses one by one. What i have to do is add 10 seconds on every action of the user on the application. Even if it is mousemove add 10 seconds so tat the application wont close for another 10

Javascript Timer Runs Sporadically

戏子无情 提交于 2019-12-13 05:30:12
问题 I am developing a messaging system and through discussion here: webBrowser.Document.Write() Irregular Performance I decided to rewite some of the core login in my program in Javascript. The demo seen here: http://nathantornquist.com/code/misc/index6.html runs perfectly when you are adding messages from John. As soon as you add a message from Jack, the timer gets messed up and the color of the date on John's messages stop changing. Can anyone see a clear reason why? 回答1: Did you check the