DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6
  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.

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links