need 30 second timer in java

+1 muler suler · October 16, 2014
hello guys i need 30 second countdown timer(clock audio) for my java game  and that audio file should be in (.wav) file format and exactly equals to 30 seconds in length thanxxxxx

Post a Reply


- page 1
Oldest  Newest  Rating
+1 muler suler · October 24, 2014
from my friend.....:D
0 Alex Sweps · October 24, 2014
haha nice howd you do it? 
0 muler suler · October 24, 2014
@Alex Sweps 

buddy i got 30 seconds timer audio....:) 
+1 Alex Sweps · October 18, 2014
Threads allow you to do more than one thing at once. So while some code is running you can have other code running at the same time. You can also put them to sleep for a while which is why they make great timers if you need a part of your program to stop for a short time. 
0 Developer John · October 18, 2014
Ok, I should ask, what are threads?
+1 Alex Sweps · October 18, 2014
Can you just use a 1 second tick sound and keep looping it while the thread counts down?

@Developer John, Runnable is an interface that is used by Threads. When you want to use a thread you need to implement Runnable. When the thread is started it will look for the run method. Similar to how your program looks for main when it first starts, threads look for run() when they are started.
0 Developer John · October 17, 2014
What is Runnable?
+1 muler suler · October 17, 2014
package thread;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class thread  extends JPanel implements Runnable {
     int counter;
     Thread cd;//declare thread
     //start method
     public void start() {
     counter =30 ; //set counter
     cd = new Thread(this);// create thread
     //stop method
     public void stop()
         cd = null;
     //run method
     public void run() { // executed by Thread
         while (counter>0 && cd!=null) {
         catch (InterruptedException e)
                 } //end of run method
    //end of thread
     public void paintComponent(   Graphics g)

            //creating screen for timer
                  g.setFont(new Font("Times New Roman",Font.BOLD,35));
                  g.drawString("Time Remaining",514,30);
                  g.setFont(new Font("Times New Roman",Font.BOLD,50));

     // main class to create object of thread class
     public static void main(String[] args) {
         JFrame j=new JFrame();
         thread t=new thread();
            j.getContentPane().setBackground( Color.BLACK );

0 Developer John · October 17, 2014
How do you make a countdown timer in Java? 
0 muler suler · October 17, 2014
sorry dude i don't need code i need an audio file of 30 seconds count down timer(tik tik audio) and i have already written code for playing audio file so now i only need that audio file i have searched in net for 30 seconds clock down timer audio but those are not satisfying my requirements. i need exactly 30 seconds audio which contain exactly one beep per second thanxxx.......
  • 1
  • 2

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator