This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet Timer

 
Konrad Cetes
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I'm trying to a count down time to my game using java applet and i have no idea where start, I've been looking online and it appears that a common thing being used is JFrame, is there way to create one so it will being counting down once the game starts, then once finished displays a screen saying game over without using a JFrame?

 
Norm Radder
Bartender
Posts: 1526
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my game using java applet

Is your program using the Applet (or JApplet) class for displaying the GUI in a browser's window
or about using the JFrame class to display the GUI?

If you need more info about applets look at the tutorial: http://docs.oracle.com/javase/tutorial/deployment/applet/index.html
 
Konrad Cetes
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It using just Applet
 
Norm Radder
Bartender
Posts: 1526
14
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, then you should look at the tutorial: http://docs.oracle.com/javase/tutorial/deployment/applet/index.html

without using a JFrame?

Applets don't use JFrames. Their GUI display area is provided by a browser.
 
Konrad Cetes
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked at it, but i didn't see anything pertaining to a countdown timer
 
Norm Radder
Bartender
Posts: 1526
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't any special relationship between any program and a countdown timer. The same code for a countdown timer would work in a JFrame as in an Applet.

You could define a class for what you want that extends a JPanel and use that class in any program.
 
Konrad Cetes
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, so then how would I make the countdown timer, because I've tried about 3 different ways and non of them seemed to work, either it would break the game or i would a list of error messages.
 
Norm Radder
Bartender
Posts: 1526
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how would I make the countdown timer,

Can you post the code you have tried (be sure to wrap it in code tags) and any error messages. The code needs to be ready to compile and execute for testing.

Basically use a Timer to call a method every time unit (eg one second) to decrement the time and display it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic