Articles
|
News
|
Weblogs
|
Books
|
Forums
Artima Forums
|
Articles
|
Weblogs
|
Java Answers
|
News
Sponsored Link
•
Java Answers Forum
a question needs help
1
reply on
1
page.
Most recent reply
: Jan 2, 2004 3:31 AM by
mausam
Welcome
Guest
Sign In
Back to Topic List
Reply to this Topic
Search Forum
Threaded View
Previous Topic
Next Topic
Flat View: This topic has
1
reply on
1
page
aj3423 aj
Posts: 16
Nickname: aj3423
Registered: Aug, 2003
a question needs help
Posted: Dec 27, 2003 10:33 PM
Reply
Advertisement
the follow code puzzles me, when i add "Toolkit.getDefaultToolkit().beep();" to it, it runs correctly. but when i remove this line ( //Toolkit.getDefaultToolkit().beep();" ), nothing will echo on the command.com,, could anyone tell me why ?
the code :
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class Temp {
public static void main(String[] args) {
int delay = 1000;
ActionListener taskPerformer = new ActionListener() {
int i = 0;
public void actionPerformed(ActionEvent evt) {
i++;
System.out.println("Hello " + i);
}
};
Timer timer = new Timer(delay, taskPerformer);
timer.start();
//Toolkit.getDefaultToolkit().beep();
}
}
mausam
Posts: 243
Nickname: mausam
Registered: Sep, 2003
Re: a question needs help
Posted: Jan 2, 2004 3:31 AM
Reply
whats puzzling in that??
remove the code...
//i++ from actionPerformed and will see that i is not increased.
Toolkit.getDefaultToolkit().beep() is the code for echo and if u remove it why it will echo...
Flat View: This topic has
1
reply on
1
page
Previous Topic
Next Topic
Sponsored Links
Web
Artima.com
Copyright
© 1996-2019 Artima, Inc. All Rights Reserved. -
Privacy Policy
-
Terms of Use