Button press loop


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Button press loop

  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Button press loop

    Hi folks,

    I am new to java and was wondering is there a way in which a java program can simulate button press such as x into a text box and loop every 2 minutes.

    All help welcomed.

    Thanks.

  2. #2
    Join Date
    Jan 2004
    Posts
    22
    I think YourTextField.setText(YourTextField.getText()+"x"); would work for the adding the x bit. Other than that, you'll need your run() to have a sixty second wait and just loop.

  3. #3
    Join Date
    Feb 2004
    Posts
    808

    Re: Button press loop

    Originally posted by tm251
    Hi folks,

    I am new to java and was wondering is there a way in which a java program can simulate button press such as x into a text box and loop every 2 minutes.

    All help welcomed.

    Thanks.
    buttons support a method doClick() that programmatically simulates clicks on a button.

    you may wish, however, to use a java.awt.Timer object, which emits window events at a specified interval to all interested listeners.. all you would have to do is configure a Timer than emits an ActionEvent to certain buttonhandlers every 60 seconds...

    note hough, that enetering an X into a text box, and pressing a button, are 2 very different things...
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  4. #4
    Join Date
    Jan 2004
    Posts
    22
    I think he may have meant pressing a keyboard button.

  5. #5
    Join Date
    Feb 2004
    Posts
    808
    heh.. yes.. i just figured it out upon rereading.. funny, the ambiguities of language....

    anyways, yes you can.. just have a look at the event model. theres a page about it here:

    http://www.utoronto.ca/atrc/referenc...usings/Events/
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  6. #6
    Join Date
    Feb 2004
    Posts
    5
    Thanks folks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center