Enums and keyboard input

I am currently enrolled in a java class. I am working on a project about enums and switch statements. I get what enums and switch statements are but what I don't get is the input/output. I need the user to be able to pick one of four anwsers.
This might be something obvious but I am new to this.

enum Command {SIT, HEEL, ROLL_OVER, BEG};
public class EnumExample {
    public static void main(String[] args) {
        String[] inputs = {"SIT", "HEEL", "ROLL_OVER", "BEG"};
        for(String input : inputs) {
            Command cmd = Command.valueOf(input);
            System.out.println(cmd);
}valueOf?

Similar Messages

  • Using Firefox 3.6 after a few mouse click/ keyboard input the firefox window is no more active, mouse click and keyboard input is inactive ; then I click on the taskbar and the keyboard is active again during a few click then it stops again etc.

    Using Firefox 3.6 after a few mouse click/ keyboard input the firefox window is no more active, mouse click and keyboard input is inactive ;
    to solve it I click on the taskbar and the keyboard is active again during a few click then it does not work any more and I click again on the task bar etc.
    after several repetitions, I have to call the task manager alt+del+ctrl, then come back to the firefox window to be able to use keyboard and mouse again

    Attaching the picture for the tab shape I want...

  • Maple13, tiling wm and keyboard input

    Hi,
    I am using a tiling wm (musca). I installed maple and at first had the problem, that maple would show only a grey window.
    Using wmname and
    wmname LG3D
    I resolved the problem. Now the problem is, that the worksheets wont accept my keyboard input.
    Mouse/menus work. All dialogs also work with keyboard input.
    If I open a new worksheet, input works. But as soon as I switch worksheet it does not work anymore.
    Anyone an Idea what I could do?
    Thanks!
    PS: I already tried sun jre (from pacman) and openjdk6 by changing the maple startup file. It's always the same

    Depending in your window manager you may have the option to add a floating workspace. Try working there. If that doesn't solve the problem you can try runing an aditional floating window manager inside a Xnest or a Xephyr session. This has worked for me for some other problematic applications. For example try:
    Xephyr -ac -br -host-cursor -noreset -screen 1280x800 :1 &
    sleep 3
    twm -display :1
    this will initiate a new X session inside yours, which will be managed by twm. There you can run a terminal and of course maple. Maybe is a sub optimal workaround, but is the only alternative I have found.
    (Note that Xephyr is found in xorg-server-xephyr package and twm, well in xorg-twm )

  • Firefox has a "jerky" response to scroll wheel and keyboard input

    Keyboard and mouse wheel response in Firefox is "jerky".
    In the case of keyboard response, sometimes I can type steadily and see characters appear, while other times several seconds may go by before I see the letters I type (for example, in filling out this form it happened three times to this point).
    The same is true of the scroll wheel on my Microsoft Intellimouse Explorer 2.0 mouse.
    At first I thought it was system-wide as I spend most of my computer time on my work computer, but I recently realized it's really only Firefox.
    I'd rather not do a total reset of Firefox if I can avoid it, as I still have a user chrome folder and a small handful of manually set about:config settings in addition to a few add-ons... unless I have certain knowledge that that will fix the issue(s).

    Have you disabled hardware acceleration?
    You might need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    Then perform these steps:
    *Click the orange Firefox button at the top left, then select the "Options" button, or, if there is no Firefox button at the top, go to Tools > Options.
    *In the Firefox options window click the ''Advanced'' tab, then select "General".
    *In the settings list, you should find the ''Use hardware acceleration when available'' checkbox. Uncheck this checkbox.
    *Now, restart Firefox and see if the problems persist.
    Additionally, please check for updates for your graphics driver by following the steps mentioned in the following Knowledge base articles:
    * [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    * [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]

  • OptionPanes and keyboard inputs/exitting program (game quit)

    Hi there,
    Im implementing my game an assignment and Ive come across a problem that I cant seem to solve. Ive created an option pane that, in a win or lose situation, allows the user to restart or quit the game- the restarting is simple enough in that if the value of the option pane = 0 then it executes the resetGame method, the trouble comes with the quit option. At present it is linked to the resetGame but what I would really like is for it to have the same effect as pressing the 'S' key in the game (i.e. stop the game and display the main screen). Is there any way to do this? Is there like a quit to previous panel option, go back a screen, anything that can exit the game- as pressing s on the keyboard stops the game and goes back to the main screen.
    The code in question is;
    // make munchies move down the screen
    for (int i = 0; i < NUM_MUNCHIES; i++) {
    if (munchieDirection == 1){
    munchieYPos[i] = munchieYPos[i] + munchieSpeed;
    if (munchieYPos[i] > (boardHeight - munchieHeight)){   // if the munchies touch the bottom the create game end situation
    gameLoseSound.play();
    int value1 = JOptionPane.showOptionDialog(null, "Would you like to restart the game? If not, press Quit and type S to stop the game.", "You Lose", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{"Restart", "Quit"}, "Restart");
    if (value1 == 0){
    resetGame();} else {
    resetGame();} //change to quit value
    AND
    // scoring and reset
    if (score >= 5){
    gameWinSound.play();
    value = JOptionPane.showOptionDialog(null, "Would you like to restart the game? If not, press Quit and type S to stop the game.", "You Win", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{"Restart", "Quit"}, "Restart");
    if (value == 0){
    resetGame();} else {
    resetGame();} //change to quit value
    Any help on this matter would be much appreciated, as although my current method may suffice- its not 100% appropriate (in my opinion)

    Got my main account working again now!
    Still having trouble for this. Ive now completed the game- its all working, but I still havent solved the quit problem.
    Is there anyway I can have the mouse click of the 'quit' button to flag up the same command as pressing the s key on the keyboard? Or is it possible to allow the quit button to allow the user to exit to the main menu?
    PLEASE HELP! IM DESPERATE!
    Thanx
    Senor-cojones

  • Application Virtualization and Keyboard Input

    Hello,
    Today I have a need to leverage SendInput and it works just fine. However the issue really is having to swap between different windows, due to the requirement for SendInput.
    I got around this by using VM's and it works great.
    However, I was wondering if there is a better way to do this, without having to have total virtual machines.
    Is it possible to sandbox applications (virtualize) them, in a stand alone environment (meaning on a single machine), where-in each has it's own Message Input Subsystem?
    Something where I would be able to run Program A (+) Program B within a "virtualized" application architecture, and have Program B use SendInput to send data to the Program A "instance" that is inside the same application virtualization
    that B is in.
    I just want to get away from having to use "remote" desktops to Virtualized Machines to make this work
    It would look like this (well if this is possible that is)
    Machine A:
    Program A + Program B = "Instance #1". They run together
    Program A + Program B = "Instance #2". They run together
    From the actual desktop of Machine A, you could "see" Instance 1 and Instance 2 but using a Program C, communicate with Program B (on a per virtualized instance)
    Thus removing the overhead of total virtual machines, but with the ability to actually do "application virtualization".
    I really want to solve my problem on the Microsoft stack, not move to VMWare
    All my other options didn't work so now I moved to virtualization, which would be pretty sweet actually :-)
    Any help / thoughts would be great
    Thanks!!

    Regardless of how they communicate, the question is this.
    Is it possible to sandbox applications (virtualize) them, in a stand alone environment (meaning on a single machine), where-in each has it's own Message Input Subsystem?
    The rest was merely a description of potential architecture, based on the fact that Program A, needs to be communicated with by SendInput, which you cannot do without swapping focus.
    No differently than if it were VM's and I had say 3 remote desktops open on my local system. I can run programs within that "sandboxed" window and each has it's own Message Input Subsystem. I am trying to mimic, that with application virtualization,
    so that I can still have that ability, but without running VM's which use way too many resources.
    Any specific information on the actual question?
    Thanks and Happy Holidays!!

  • Design question ... Remote control and keyboard

    Hey i am building a system that should support remote control input and keyboard input
    the system is a addons based any user could build any addon he wishes
    i have now two main input events types
    KeyEventand
    RemoteControlEventi wish to use only one type of event
    i am thinking of 2 options.
    1) Map
    RemteControlEventto
    KeyEventif this why is the best what happens i a situation that i mapped J key to the RECORD button
    how a specific addon should know that a RECORD operation is pressed or it's just a J button
    2) Write a new events that contains
    KeyEventactions and
    RemteControlEventactions
    thanks allot

    thanks for your replay
    i am sharing my thoughts with you ,cause i relay want to do it the best way.
    when i mention remote control i meant using a TV/VCR/MCE Remote Control.
    (i am usingJLIRC ( LIRC ) )
    and i have decided .
    i will listen to all keyboard event using "dispatchKeyEvent"
    and will map Remote control keys to keyboard keys
    here is another question to make sure i understand fully .
    the application that i am writing is an add-on based
    every programmer that will like to create an add-on
    will extend the "Screen" object for is main panel (Screen exnteds JPanel)
    so i was thinking when dispatchKeyEvent called i should call dispatchKeyEvent in the current displayed screen
    (if the screen dispatchKeyEvent returns false.
    the main dispatchKeyEvent should continue.
    case true the main dispatchKeyEvent will return true)
    then in the screen implementation the user can ask if this key is an Spacial Key
    if yes he can get the spacial key attached to this keyboard key
    i just wrote an example of how it's suppose to be
    public MP3PLayer implemants Screen {
      public boolean dispatchKeyEvent(KeyEvent e){
        boolean isSpeacial = RemoteComtrolKey.getInstance().isSpeacialKey(e.getKeyCode);
        if(isSpeacial){
            int mappedKey = RemoteComtrolKey.getInstance().getSpeacialKey(e.getKeycode());
            if(mappedKey  == RemoteComtrolKey.REC){
              //do the record
               return true;
        return false;
    }georgemc thank you very much

  • How to fix the mouse and keyboard freezing when installing Windows 7 on 27' iMac late 2013?

    Hi, I have a question for u guys who can solve this.
    I recently bought the new 27' iMac late 2013, and I installed some softwares and used it for few days.
    Before I bought this I used the 15' Macbook Pro Retina, I installed Windows 7 Home Premium 64 bit, and I used the Windows for gaming.
    So back to my question.
    So I bought the new iMac and I was tying to install Windows 7 Home Premium 64 bit (with the same CD).
    After dividing the partition, and other stuff, the iMac rebooted and I hold down the option (alt) key. I choose the Windows CD, and it said it is "getting ready to install Windows". I let it load, and the blue screen where you choose the language, time/location and keyboard input popped up. At the bottom right corner (at the same page), there is a button that said "Next (N)" which u need to click it to go to the next step. I was moving my mouse to click the button, but I realized that my mouse and keyboard was frozen. I tried both wireless and wired mouse and keyboard but they didn't work. There was nothing I could do. I hold the power button, (that was the only option) and tried my mouse and keyboard on Mac OS and it worked fine.
    I thought something went wrong in the CD so I bought the Windows 7 Ultimate 64 bit. The result was same. It frizzed again. (I just wast few hundred $)
    Latter my friend lend me his Windows 8.1 Pro 64 bit. I tried it, and it worked, it didn't freezed on Windows 8.
    The problem is I played Battlefield 4, Titan fall, and Watch Dogs, and Battlefield 4 multiplayer doesn't work on Windows 8.1. Even though when it works on Windows 8, I prefer using Windows 7.
    Dose anyone knows how to fix this freezing thing?
    My computer is:
    27' iMac late 2013 (bought it just few days ago)
    I did no upgrades when I bought it, except the graphic card.
    I bought the iMac in Korean Apple Store, and my Windows CD is in Korean, can that be a problem?
    Please leave a comment when u think u can solve my problem.

    See -> http://manuals.info.apple.com/MANUALS/1000/MA1636/en_US/boot_camp_install-setup_ 10.8.pdf.
    In addition to the Windows disc (or USB flash drive with the Windows installer) you'll need a 8GB+ flash drive.
    The referenced manual - on page 3, I think, gives you a run-down of what you'll need before you begin the installation. You may also want to post any further Boot Camp questions in the Boot Camp forum -> https://discussions.apple.com/community/windows_software/boot_camp.
    Good luck,
    Clinton

  • Keyboard input stopped working on Solaris 11 Live x86 Toshiba R835 Notebook

    I can boot, and keyboard input works for login, but does not work for xterm, terminal, Firefox, ... Mouse works for gparted and apps. It did work for 8 hrs but stopped. Any suggestions ?

    brebs wrote:
    (EE) Error loading keymap /tmp/server-0.xkm
    I would be googling for that. E.g. see thread.
    So did you update xkeyboard-config? It's tedious that you haven't had the sense yet to list which packages got updated, along with version numbers.
    It's nice to see you enter here, brebs!
    A few things have happened:
    I just noticed that the file '/etc/X11/xinit/xinitrc' isn't present at all! It was present when I posted the thread (I think). So X didn't even start. I had to create .xinitrc in my home directory with single like 'exec xterm'. X started fine but keyboard still didn't work.
    Out of nowhere, I thought of using nouveau drivers instead of Nvidia drivers. So I went ahead and switched to nouveau and bam - keyboard is working. Enabled GDM and keyboard is still working. I still would like know what went wrong with Nvidia - for educational purposes.
    What more details should I provide? I'd like to have Nvidia drivers back.
    Last edited by akshay2000 (2013-02-25 16:17:07)

  • Keyboard input has stopped working in MS Word - Yosemite

    I made the mistake of upgrading to Yosemite in December.
    The latest issue is in MS Word (2011, version 14.3.6)
    When trying to switch between two Word documents, the keyboard input stopped working. I am using the built-in Mac keyboard. The trackpad still works, and keyboard input works in some programs (Safari), but it's impossible to type anything into Word. I've tried "Esc" in case some menu was selected, but to no avail.
    I've also had this problem in EndNote.
    Curious if anyone has a solution - and if you have tips for how to get Word to run faster in Yosemite, please post!
    Thanks ~

    There have been a couple reports of keyboard failures, mostly initial key presses. Mine initialy caused USB bus timeouts and startup problems and then failed completely. Call Apple or take the machine/keyboard back to a Apple store for a replacement.

  • TS3280 How can i enable both paired bluetooth and ios keyboard input at the same time?

    How can i enable both paired bluetooth and ios keyboard input at the same time?
    This is needed for the app im working on. Need some user input via keypad as well as scanner input via a paired bluetooth scanner.

    You probably should not be using a keyboard bluetooth profile for a scanner, I am not a developer for apple so do not know the location for you to find out the correct profile you should be using for an input device that is not a keyboard. Sorry,
    I am sure if you navigate the apple developer site you will probaly finmd what you're looking for.
    https://developer.apple.com

  • I have a new mac book pro (sept 2014) and am suddenly stuck on the log-in screen. Keyboard input not working to enter my password. Already tried a basic restart and a cmmnd/ cntrl/ pwr troubleshoot to no effect.

    I have a new mac book pro (sept 2014) and am suddenly stuck on the log-in screen. Keyboard input is not working to enter my password. Seems to be a log in issue as keyboard works for forced troubleshooting. (And b/c when I first noticed the problem, I was able to enter my log in password but then everything sort of froze. Now, no ability to enter the password.) Already tried a basic restart and a cmmnd/ cntrl/ pwr troubleshoot to no effect.

    Reset PRAM:   http://support.apple.com/kb/PH14222
    Start up in Safe Mode.
    http://support.apple.com/kb/ph14204
    A new Mac is in warranty for 1 year from the date of purchase.
    A new Mac comes with 90 days of free tech support from AppleCare.
    AppleCare: 1-800-275-2273
    Call AppleCare or take it to the Apple store to have it checked out.
    Genius Bar reservation
    http://www.apple.com/retail/geniusbar/
    Best.

  • How to have same keyboards input source in Mac and Windows???

    I use Canadian French-CSA on my Mac keyboards input source. Using Windows 7, I can't find the good setting for my keyboards to be the same when I it keys.
    I run Windows over Parallels Desktop
    Can anybody help?
    Thank you

    Can I use an AirPort Extreme Base Station "n"
    Yes.
    and if so, will my MacBook work with this at maximum download / upload speed (i.e. equivalent to the cable)
    The speed of your internal network generally is much much faster than the speed of your internet connection. Unless he has an internet connection faster than approx 6Mbps then even dropping down to the old 802.11b Airport would not seen any decrease in speed of downloads etc...
    and will my brother's PC's also be able to connect?
    If his PC is 802.11b/g-compliant, it shouldn't have any problems connecting to the AirPort base station.
    Or is there another Airport base station?
    The other AirPorts would work, but the AirPort Express & older 802.11g AirPort Extreme base stations have a max. range of 150 feet.
    OR-- should I head down to "Generic Computer Store" and just by a wireless router (WiFi)(think that's what they call them) and connect this to his cable modem? IF SO WILL THAT WORK FOR MY MAC?
    That is always an option as well, especially since he will be the primary user throughout the year. I'd suggest going with a brand name, like Belkin, D-Link, or Linksys for the wireless router choice.

  • Firefox and Thunderbird are suddenly not accepting keyboard input

    Keyboard shortcuts still work just input in any kind of input field fails so I can still use ctrl+C / CTRL+V to somewhat use firefox and Thunderbird But all input fields are completely unresponsive to keyboard input
    The problem suddenly arose while I was browsing.
    I have the same issue on all program's based on the Gecko engine and I confirmed them so far in Firefox, waterfox, instantbird, thunderbird and fossamail. However chromium / windows / basically everythign n
    To fix it I tried the following:
    Restarting firefox
    Restarting firefox in savemode
    Rebooting
    Changing the keyboard layout in windows
    Using a different keyboard
    Again rebooting
    Pressing F7 to check for caret mode which was disabled
    pressing winkey + F9 (Whatever that does)
    I am running windows 8.1(x64)

    Solved, Changing the keyboard layout again and rebooting fixed it. I tried using the on screen keyboard which worked so I changed the keyboard layout again and rebooted and now it works just fine. I still wonder what caused a Gecko wide issue like this?

  • Take printscreen and detect mouse/keyboard input

    hi guys,
    I'm looking a way to take printsceen and detecting mouse/keyboard input in Adobe Air app using html/ajax .. is it possible ?
    any ideas ..please

    I wrote a blog post on how to do screen capturing using Adobe AIR abnd HTML/JavaScript. Maybe it'll help you out:
    http://www.andymatthews.net/read/2009/11/05/Capture-BitmapData-with-JavaScript-AIR-applica tions
    As for detecting key input, you can add a keydown/keydown event to the document quite easily.
    document.addEventListener('keydown', function(evt){
         // do something

Maybe you are looking for

  • Can I create member log-in and data storage with my Muse account?

    I'm looking into the Muse product for a possible new client who will need to collect member data and post it onto the site. I want to know if this function can be created in Muse and with my Muse account.

  • X11 crash

    Hi, X11 crashes after I logged in to remote server and launch the application. ssh -X user@servername matlab I got the following crash report: Process:               X11.bin [1775] Path:                  /Applications/Utilities/XQuartz.app/Contents/M

  • Format utility unable to select labeled disk

    I have a system running Solaris 10 x86, booted with 64 bit kernel. Recently, i decided to add a second hard drive to the system. The drive is Seagate ST340014A (40GB ATA drive). I ran format and managed to fdisk, partition & label the disk, but later

  • Using accents/special characters in keyboard WAY TOO SLOW!

    I'm often using french, and thus many words have many accents (just a short phrase exemple : l'été passé j'ai dû boire l'amère potion de la déception... A short sentence, 5 accents. Can be worse). I'm typing pretty fast, and already getting frustrate

  • Logging Behavior

    I have noticed that output from running java class files, such as error messages, seem to be automatically cleared from the log window from time to time. Is there a way to keep this from happening? Has this happened to anyone else? I also notice that