Results 1 to 4 of 4
  1. #1
    quazareth is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Java Application Flow (pause & wait?)

    Hello, I have several USB devices I've connected to a linux box which have available API's. I'm trying to write a java application to access them and gather data. My first attempt worked pretty well (or well enough) I just have a question about application flow. How do I make the program pause and wait for an event? and once the program has completed how do I make it restart and wait again? Below is the rough flow I'm trying to achieve:

    Program Runs -> Wait for action (enter button, usb sensor doesn't matter) -> display thank you (wait 10seconds) -> restart process.....

    Currently I'm using a while loop with Thread.sleep(100000); but I'm sure there is probably a better way to-do this. Once it runs I need it to just hang until a user input event has happened, and then how do I display a thank you message, wait 10seconds, and then restart it to where its waiting again?

    Thanks in advance!
    Last edited by quazareth; 04-19-2012 at 09:33 PM.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default Re: Java Application Flow (pause & wait?)

    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    quazareth is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Re: Java Application Flow (pause & wait?)

    is there a way to-do it without a gui?

  4. #4
    jlczuk is offline Senior Member
    Join Date
    Apr 2012
    Location
    New York State of Confusion, USA
    Posts
    137
    Blog Entries
    1
    Rep Power
    0

    Default Re: Java Application Flow (pause & wait?)

    Perhaps the Java Executor Interfaces could be applied here. This assumes that the USB APIs to which you refer can be used to notify you of an event which would be your trigger.

Similar Threads

  1. Flow layout
    By Shahnawaz in forum New To Java
    Replies: 2
    Last Post: 10-04-2011, 09:24 PM
  2. Flow-Charting?
    By danthegreat in forum Forum Lobby
    Replies: 4
    Last Post: 09-12-2011, 06:24 AM
  3. [ASK]Java Flow Chart to source code
    By potatosaladz in forum New To Java
    Replies: 0
    Last Post: 12-28-2010, 06:11 AM
  4. How to generate Data Flow Diagram(Work Flow Diagram)
    By stsivaraj in forum AWT / Swing
    Replies: 1
    Last Post: 12-22-2010, 11:21 PM
  5. Java + information flow 3.0
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-20-2007, 09:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •