The Artima Developer Community
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

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  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 to this message 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 to this message 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
Topic: native driver for sql server 20000 Previous Topic   Next Topic Topic: need help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use