Process keyboard commands without prompting

I am 5 weeks into my first Java course with no previous programming background. We are implementing John Conways game "LIFE" a 2D Cellular Automata. From the command line I read in 5 args, width, height, cell size, delay and a random seed value. I have the program accepting the args and drawing the displays. While the program is running the user should be able to type in commands such as quit, step which one steps the display etc. Everything I have done so far, tried or read such as System.in or .next or hasNext prompts the user for input. How do I read keyboard commands without prompting the user? Please don't laugh at my ignorance. Maybe at 48 years old I'm just too old to learn this stuff. Thanks much.

I am 5 weeks into my first Java course with no
previous programming background. We are implementing
John Conways game "LIFE" a 2D Cellular Automata. From
the command line I read in 5 args, width, height,
cell size, delay and a random seed value. I have the
program accepting the args and drawing the displays.
While the program is running the user should be able
to type in commands such as quit, step which one
steps the display etc. Everything I have done so far,
tried or read such as System.in or .next or hasNext
prompts the user for input. How do I read keyboard
commands without prompting the user? Look at the KeyListener interface. You need to know how to use Interfaces, and how to implement listeners for your swing components. With a KeyListener, you can detect when keys are typed. This is event driven. so you perform actions on the key being pressed and released. the keyTyped() method is probably what you will want to use. If you are planning on using single key commands (q == quit, s == step), this will be pretty easy to use. If you want the user to spell out the command, you may want to detect a key stroke, then open a text input field for the user to type the full command.
Please don't
laugh at my ignorance. Maybe at 48 years old I'm just
too old to learn this stuff. Thanks much.Not.
Good luck.
� {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • PRAM Reset without keyboard commands.

    How do I reset the PRAM without using the "CMD+Option+p+r..." keyboard commands?    Keyboard commands no longer work.   Is there away to do this via the Terminal or to restore the keyboard function?

    Might pull the PRAM Battery and all power/peripherals &...
    How to reset the SMU/PMU on a Power Mac G5 (Late 2004) or Power Mac G5 (Late 2005) ...
    http://support.apple.com/kb/HT1436

  • G5 will not boot into OSX - stays at a command-line prompt

    My G5 will not boot into OS X. I would appreciate and and all advice. Thanks.
    What happened:
    I had the G5 running one morning, with the Isight camera on, plugged into the front-console firewire port. I was running EvoCam software.
    At about 2 hours into running, the cam stopped broadcasting – I got home to check it out three hours later, and the screen was black, and the fan was louder than I had ever, ever heard it on this box.
    I did a hard shut-down with the powerbutton on the Cinema Display monitor.
    At reboot, I see a grey screen for approx 5 seconds, with a dark grey apple logo, and then the screen goes to black, with a command-line prompt.
    It’s been like that ever since.
    I ran the Apple Hardware test, from the internal CD drive, and it shows no errors.
    I cannot boot from an OSX installer DVD. It won’t recognize it. It goes straight to the black screen and Command line prompt.
    I have re-seated the RAM, as well as the Airport Card. The only other card – which I have not re-seated, it the video card.
    I am able to use the machine in Target Mode, so I can extract data from the drives, which is great. Oddly enough, I’m able to use the front-console firewire port to connect to my other Mac in Target mode – with no problems. Also – in Target mode, the fan never goes above the usual quiet self.
    I would appreciate any advice one can provide. Thanks!
    The machine:
    Mac G5 dual 2.0 – First Generation (purchased December 2003)
    It’s on it’s 3rd Motherboard – and now it’s fully out of Applecare warrantee.
    OSX 10.4.9
    4GB Ram
    2 internal drives: 160GB + 300GB
    Airport Extreme
    20” Cinema Display (first generation)
    Mac G5 dual 2.0 – First Generation   Mac OS X (10.4.9)  

    Well, Apple Support does have articles on:
    Isolating Issues in Mac OS X
    http://docs.info.apple.com/article.html?artnum=25392
    won't boot or login
    http://docs.info.apple.com/article.html?artnum=106464#symp1
    And if those don't work, call.
    With G4 there is/was
    "Fix for a Mac that won't power up
    Mirrored Doors G4. When you pressed the power button, the button would light up, but the computer would not turn on. The fans on the power supply wouldn't turn on.
    FIX: unplug the machine, pull the clock battery, hit the power button to discharge. Then plug it in without the clock battery. The machine should boot perfectly. Shut down, reinstall the clock battery, and now the system is fully functional. Macosxhints
    http://docs.info.apple.com/article.html?artnum=300552
    Reseat video? try another video card?
    My Step #1 is to always boot into Open Firmware (and do reset-nvram, reset-all, if you can't do that, you are sunk).
    Oh, and What do you see in verbose mode on startup?
    Mac Pro 2GHz 4GB 10K Raptor 23" Cinema   Mac OS X (10.4.9)   WD RE RAID Aaxeon FW800 PCIe MDD-G4 APC RS1500 Vista

  • Shut Down Without Prompt

    Hello. I have a Mac Mini connected to a TV. Although I have a wireless keyboard and mouse for it, I usually use a remote, or connect via VNC. I would like to be able to shut it down by just pressing the power button,  like you can do on any PC, but instead,  when I push the button it asks me for confirmation. Is there a way to have it just do a clean shutdown without prompting me? Thanks.

    Hi Diane, follow these instructions to the letter, especially the part about leaving it in sleep mode without power for at least 5 hours:
    1) Plug in the power adapter and fully charge your PowerBook's battery until the light ring or LED on the power adapter plug changes to green and the onscreen meter in the menu bar indicates that the battery is fully charged.
    2) Allow the battery to rest in the fully charged state for at least two hours. You may use your computer during this time as long as the adapter is plugged in.
    3) Disconnect the power adapter while the computer still on and start running the computer off battery power. You may use your computer during this time. When your battery gets low, the low battery warning dialog appears on the screen.
    4) At this point, save your work. _Continue to use your computer; when the battery gets very low, the computer will automatically go to sleep._
    5) _Allow it to sleep for five hours or more._
    6) Connect the power adapter and leave it connected until the battery is fully charged again

  • Way to change the universal keyboard commands?

    I HATE, HATE, and absolutely HATE Apple's new keyboard command for closing a document without saving it, which goes against all of Apple's other keyboard commands since the beginning of the Mac.
    Is there a way to change it? I could create a macro in a third-party macro utility, but it seems like I would have to do this in every Apple app I own.
    Is there any way to change the universal system preferences so that command-D closes a document without changes like it used to?

    No. It's borked and Apple won't fix it. I solved the issue by running TextEdit 1.6 from Snow Leopard wherein CMD+D works.

  • Execute a command without thread

    Hi....i have to execute a command in DOS and i'm using runtime java class with its method exec(). The process works perfectly but in my code i have to execute that command without a thread because the successive operations will work only if the command terminated correctly. What can i do to resolve it?

    String cmd = input.getTxtDb2Cmd();
    Process p = Runtime.getRuntime().exec(cmd);
    int r = p.waitFor();
    if (r != 0)
    throw new RuntimeException("db2 command failed");
    i've to invoke a db2 command that import a txt file in a db table. After this code i've some operations that works with this table so i've to terminate this import before execute other functions.

  • Opening external files directly?(without prompting)

    Hello,
    I'm making a DVD menu in flash. It will open several kinds of files. .mov .avi . ppt . pdf etc.
    But i want to open those files directly, without prompting. When i try to open non web files, a popup window appears, as shown in this screenshot: http://img32.imageshack.us/img32/5188/testtemp.jpg
    Can i remove it?
    I tryied to open the ppt file in the example with this ActionScript 2.0 code:
    on(release)
    getURL("estudo_01.pptx");
    Regards,
    Felipe

    If you're publishing an executable you need to look into the FSCommand functionality and use it to "run" an exec command against your files. Using getURL prompts the system to open the file using the browser, and naturally the browser wants to download the file first.
    Alternatively you can publish (if you have CS4 or up) a native executable using AIR 2.5 that can run simple load and execute the file but that's most likely more complex than just using FSCommand in your current project.
    Here are a couple of links to help you out with that:
    http://www.actionscript.org/forums/showthread.php3?t=18405
    http://www.northcode.com/blog.php/2007/08/14/FSCommand-EXEC-is-Broken-in-Flash-CS3

  • Can someone fix Firefox 10 so it doesn't undermine my Adobe Creative Suite 5.5 keyboard commands?

    I notice this most frequently in Photoshop - the keyboard stops responding to keyboard commands (e.g. "m" to select marquee tool does not work, command-spacebar to select zoom tool does not work). All I have to do is to quit Firefox and they work again. So there is a conflict between the two. I would like to be able to to run Firefox in the background without having an issue. There is no way Adobe is going to fix it at their end, so I was hoping someone could address this. iMac 2.8Ghz Intel Core i5; 8 GB 1333 MHz DDR3; OS X 10.6.8

    deactivate your installation on your old computer (help>deactivate).
    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
    Lightroom:  5.6| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • System wide keyboard commands not responding

    My mac stops responding to system wide keyboard commands such as the Dashboard, Expose and Spotlight shortcuts. It also does not respond to Command-Tab to switch between applications. Hitting the keys for any of these leads to no response whatsoever.
    I have run into this problem several times over the last few months, and the only solution I have found is to restart the computer. Initially, it appeared to be related to the ScreenSaver process crashing. I could look in the System Monitor and see that this process had gone red, when I forced the process to quit, the keyboard commands were restored. More recently, though, this has not been the case, and I have had to restart.
    Any guesses what could cause this or suggestions on how to diagnose it? Thanks for any help.

    I'll answer in reverse.
    When I've experienced the problem, I have tried other (older style) keyboards, and that did not resolve the problem.
    I've never tried creating another user account.
    I'll try disabling the screen saver, but part of the problem is that this issue is sufficiently intermittent that it take a while to determine if this has a benefit. I was hoping to find some more systematic way to diagnose what has been happening. Any suggestions along these lines?
    Thanks for your help and interest.

  • Keyboard command-b works, return to plain text via command-t doesnt work

    I am helping my Dad out here, we have figured out a couple of glitches he is having using the Word Processing thanks to Discussions.
    The last thing we cannot figure out is that he has been used to typing keyboard command-b, then a string of bold words, then command-t to go back to regular text, but it is not returning to plain text anymore, it is printing super text. he has to change it 2x via the menu bar. Time consuming and annoying because command-t used to work.
    Any advice on this one?
    Thank you.

    Is the behavior specific to one document or a few documents, or does it affect all word processing documents?
    *+It is happening to two very long documents that i tried it on, but not to a couple of shorter ones he has.+*
    Is the behavior specific to one account? Test by opening and working on an affected document using a different account. (You may need to Get Info on the file and change Ownership and Permissions to allow "Others" to "Read and Write", and you may need to create a second account on the machine.)
    *+There is only one account being used.+*
    What version of the Mac OS is your dad using?
    +*Mac OSX 10.2.8 on an iMac PowerPC G4*+
    What version of AppleWorks?
    +*AppleWorks 6.2.7 (he is 87 and understandably doesn't want to upgrade unless absolutely necessary. He is working on something relatively important, and wants to finish it up. If it were me,...*+
    Maybe a glimmer: What happens if you're typing plain text, press command-T (once), continue typing another word, press command-T again, and continue typing?
    +*In one of the offending documents, I tried that, it went from plain text to SUPERIOR text, back to plain. It seems to be toggling between plain and SUPERIOR on some of the documents (the two longest, hundreds of pages documents.*+
    **He is very happy this is getting worked out, at least things are better. I will be here tonight, then I go back home for several weeks at least, so will check back again later. If something comes up I can do it tonight, or maybe talk him through it next week. In any event, I will keep up with the post.**
    **Thanks for all the time.**

  • How to move files by using a keyboard command?

    On Windows or Ubuntu, If I choose a file, press control & x and press control & v in a different folder, the file can be moved easily without dragging the file in to the destination folder. I tried to do the same thing on Mac OS X, but Mac OS only allows me to use apple & x if I tried to cut texts. Is there any way to use keyboard commands or other ways to move files not by dragging?

    no. you can not cut files in OS X. But you can copy and paste with command+c and command+v. also, you can install a 3rd party contextual menu to move files which will be available from the right-click menu.
    http://www.macupdate.com/info.php/id/26158/movecm

  • Keyboard commands not working with pen tablet attached to MacBook Pro

    HELP!! I can't use the clone tool in Photoshop! None of my keyboard commands are working, zoom in, zoom out...etc.
    I went through iCloud and reset Photoshop, InDesign and Illustrator keyboard, but my keyboard on my MacBook Pro
    is not working with adobe CC.
    Is it my Bamboo pen tablet attached causing this problem?
    Please advise.
    Thanks.

    You will likely get better program help in a program forum
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Dynamic Command Parameter Prompts twice for Value

    I am having trouble in CR 2008 with command parameters.  Whenever I make the command parameter dynamic, I am prompted twice for the value: first I'm prompted to enter the value freehand, then the second prompt is a dropdown list with just the freehand value (or an error if the freehand value does not exist in the db).
    I need to use dynamic command parameters for two reasons: 1) to allow users to select the value from a dropdown list rather than a free-text value, and 2) to limit the record set returned from my initial command query.
    Any help on how to get dynamic command parameters to display all values in a dropdown list, and in one prompt, is appreciated!

    Hi
    If you create a parameter in your command it will be always static.  You can't make this as dynamic because, once your command get executed only you will get values in your report or in your list of values (dynamic parameter).
    There is a work around for this :
    --Create a report with command without any parameters at command level
    --Create a dynamic parameter at report level and do not place any fields in your report.
    --Now insert your orginal report as sub report in Report footer.
    --Right click on your sub report and go in change sub report links and link Main report dynamic parameter to your sub report command parameter.
    --Suppress all other section in your main report.
    Now when you refresh, it will execute your main report dynamic parameter with pick list.  Once user selects a value it will be passed to your command parameter.
    Thanks,
    Sastry

  • Desktop Manager shuts down without prompt in the middle of sync

    Hello All,
    My desktop manager shuts down without prompt in the middle of sync without an error message.  Each time I sync I have to reopen it mutiple times before a sync in completed.  Has anyone else experieced this
    BB 8830
    Windows XP OS

    I have been getting the "DM has encountered a problem and needs to shut down" message each time a connect my device (pearl).  Have tried several of the tips I have harvested from these forums:
    Delete the intelisync folder (http://www.blackberry.com/btsc/dynamickc.do?externalId=KB11703&sliceId=SAL_Public&command=show&forwa...)
    FIXPST (http://supportforums.blackberry.com/rim/board/message?board.id=BlackBerryDesktopSoftware&message.id=...)
    Uninstall and Reinstall DM
    But to no avail.  Still looking for the right approach

  • Cursor works when passing over a command without touching the Touchpad

    The cursor on my iMac regularly engages by merely passing over a command without clicking the touch pad.  All i can do is force stop the machine because the cursor performs unwanted commands before I can get the cursor to restart or Shut Down.

    tjk wrote:
    Hi s,
    First try a PRAM Reset: http://docs.info.apple.com/article.html?artnum=2238
    If no luck, try an SMC Reset: http://support.apple.com/kb/HT3964
    In some cases, the battery can interfere with a cable between it and the inside of the MBP, causing keyboard and/or trackpad issues. Shut down the MBP, disconnect the power adapter, remove the battery, take a piece of something semi-soft (like a paper napkin foldedover a couple times), place it over the cable you see in the battery compartment, and tape it down. Replace the battery and see how things go. If this works, you'll eventually want to replace the keyboard/trackpad cable (about $25 if you can do the work yourself). Note that if you go to a repair shop, they usually want to replace the entire top case assembly, which is much more costly.
    If the issue persists, shut down, disconnect the power adapter, remove the battery, connect the power adapter, boot the MBP and see if the issue persists without the battery in place (but remember to save a lot, because if the power adapter gets pulled out the MBP will immediately shut down and any unsaved work will be lost).
    Also look at the battery to see if it has any signs of deformity/bulging, in which case do not use it again (it may be pushing on the keyboard/trackpad cable and causing the issue); it must be replaced.
    First off Sir or lady tjk, I do a PRAM reset weekly and it's never fixed diddly for this issue, I'm sorry to report. The cursor going awry usually happens in Mail when composing or replying to emails, so I wondered if Mail was corrupted, but alas, no. Still happens.
    Upon inspecting the battery and the compartment, both appear normal. No bulging or binding either (a brazzier reference).
    I did the SMC reset before I read your post, but apparently not to Apple's spec so will try it again. Then will see what's up doc.

Maybe you are looking for

  • How to delete a "double" contact list

    For a mistake I imported the contact list of a friend in my iPhone 3gs. Now in contact list as "all in the PC" i've his 500 contacts. I can't delete one by one (i spend too much time), I try it by iTunes or other way but i didn't find a solution... S

  • How to create a keyboard shortcut in firefox for email link

    I would like to create a keyboard shortcut for firefox for the EMail Link menu item. I specified shift-Command-S as the keyboard shortcut. When I hit the key sequence the File on the menubar flashes but the Email Link window never opens. Does anyone

  • Process Composer - node mapping

    Hello, I have a table (ie ID, Name) in my first Web Dynpro application, and i want to pass it to another Web Dynpro application using Process Composer. Everything works fine, when there is only one record (row) in table, but when i add another, click

  • XMLBeans - Regarding "HAS A" relation

    Hi, I am new to XMLBeans and using the same for converting JavaBeans to XML. I do have some exposure to JAXB. I am planning to use XMLBeans in place of JAXB. I could not find few answers in the Internet. Please do help me on the below query: As Menti

  • Special Ledger with FYV 365 periods (daily balance) / K4 in FI

    Hello, I have set up a ledger in the module Special Purpose Ledger. In FI the assigned company code has fyv K4. In SL fyv DB (which has 365 periods) is assigned to the company code. In customizing step "local periods" I specified period 1 to 365 for