Okay... brain fart. I want to make a simple clock. So, I have seconds, minutes, and hous. therefore, in order for it to increase i need the seconds to start off.. (and its digital format) so how do I get the seconds to increase by 1 in exactly 1 second?
Live And Let Learn.
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
use a timer
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
dah!!! I know how to do that, why didn't i think of that! I really did have a brain fart!!
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
I havn't done this for a while. I get 4 errors. What am i missing or screwing up on?
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
nvm, i got it.
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
Now i'm having trouble, can someone help me get it to increment by 1 second.
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
nvm, got it again!!
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
k, now i'm stuck, why isn't it repainting and ridding the previous number?
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
> why isn't it repainting and ridding the previous number?
you need to include, in paint() super.paint(g);
as you're using JApplet, it might be a whole lot easier for you to use a JLabel
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
I forgot super as well, i shouldn't of stopped doing this, I used to know this stuff, thank!!
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
why isn't my background black i said it was?
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
try it like this - using swing's paintComponent()
Martin vanPutten
Ranch Hand
Joined: Mar 26, 2006
Posts: 124
posted
0
How can i set the clock to real time?
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
SimpleDateFormat to match the pattern you have then just g.drawString( sdf.format(new Date()) , 270, 60);