Keycode display program not working

Hey, I wrote this code that detects the keycodes then displays them into the status bar and in the applet window, This worked fine. I then added an if statement so it would display the message "ESC KEY" if the Esc key was pressed I can't find any reason why i'ts not working i've tried putting the if statement in many different places in the program but it still won't work. I am definately saving it.
Can anyone help?
<CODE>
// Luke Mildenhall-Ward
// KeyCode Display program
// December 2002
// Imports
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Pong3 extends Applet implements Runnable, KeyListener
// Variable declaring
public String message;
public int keyCode;
public Thread pongt = null;
// Initialisation
public void init()
addKeyListener(this);
pongt = new Thread(this);
pongt.start();
// Key Listening
public void keyTyped(KeyEvent key) {}
public void keyReleased(KeyEvent key) {}
public void keyPressed(KeyEvent key)
try
keyCode = key.getKeyCode();
// THIS IS THE (if) PART THAT I'VE RECENTLY ADDED:
if (keyCode == 27) {
message = "ESC KEY";
else {
message = "Key = " + keyCode;
catch (Exception ex) {}
// Start
public void start()
if (pongt == null)
pongt = new Thread(this,"pongt");
pongt.start();
// Stop
public void stop()
pongt = null;
// Run
public void run()
Thread thisThread = Thread.currentThread();
while (pongt == thisThread)
// Status bar
showStatus(message);
try {Thread.sleep(20);}
catch (InterruptedException e){}
// Issuing repaint
repaint();
// Painting
public void paint (Graphics g)
g.drawString(message, 100, 100);
</CODE>

Note that you can use the getKeyText() method to get the 'name' of the key automatically.     
public void keyPressed(KeyEvent e)
          System.out.println("PRESSED: " + e.getKeyText(e.getKeyCode()) + "\n");
     }

Similar Messages

  • Installed Premiere Pro CS4 but video display does not work?

    I just got my copy of CS$. After installing Premiere I found two things that seem very wrong:
    1) video display does not work, not even the little playback viewer next to improted film clips located on the project / sequence window. Audio works fine.
    2) the UI is way too slow for my big beefy system.
    My pc is a dual boot Vista-32 and XP system with 4GB of memory installed and nvidia geforce 280 graphics board with plenty of GPU power. The CS4 is installed on the Vista-32 partition. My windows XP partition on the same PC with Premiere CS2 works great and real fast.
    Any ideas how to solve this CS4 install issue?
    Ron

    I would like to thank Dan, Hunt, and Haram:
    The problem is now very clear to me. The problem only shows up with video footage imported into PP CS4 encoded with "MS Video 1" codec. So this seems to be a bug. The codec is very clearly called out and supported within various menues but video with this codec just will not play in any monitor or preview window. In addition the entire product looks horrible with respect to performance while PP CS4 trys its best to play the video. Audio will start playing after about 30 seconds. And once in awhile part of video shows up at the wrong magnification before blanking out again.
    My suggestion to the Adobe team: fix the bug and add some sample footage to the next release so new installations can test their systems with known footage.
    My PC is brand new with the following "beefy" components:
    Motherboard
    nForce 790i SLI FTW
    Features:
    3x PCI Express x16 graphics support
    PCI Express 2.0
    NVIDIA SLI-Ready (requires multiple NVIDIA GeForce GPUs)
    DDR3-2000 SLI-Ready memory w/ ERP 2.0 (requires select third party system memory)
    Overclocking tools
    NVIDIA MediaSheild w/ 9 SATA 3 Gb/sec ports
    ESA Certified
    NVIDIA DualNet and FirstPacket Ethernet technology
    Registered
    CPU: Intel Core 2 Quad Q9550
    S-Spec: SLAWQ
    Ver: E36105-001
    Product Code: BX80569Q9550
    Made in Malaysia
    Pack Date: 09/04/08
    Features:
    Freq.: 2.83 GHz
    L2 Cache: 12 MHz Cache
    FSB: 1333 MHz (MT/s)
    Core: 45nm
    Code named: Yorkfield
    Power:95W
    Socket: LGA775
    Cooling: Liquid Cooled
    NVIDIAGeForce GTX 280 SC graphics card
    Features:
    1 GB of onboard memory
    Full Microsoft DirectX 10
    NVIDIA 2-way and 3-way SLI Ready
    NVIDIA PureVideo HD technology
    NVIDIA PhysX Ready
    NVIDI CUDA technology
    PCI Express 2.0 support
    Dual-link HDCP
    OpenGL 2.1 Capaple
    Output: DVI (2 dual-link), HDTV
    Western Digital
    2 WD VelociRaptor 300 GB SATA Hard Drives configured as Raid 0
    Features:
    10,000 RPM, 3 Gb/sec transfer rate
    RAM Memory , Corsair 4 GB (2 x 2 GB) 1333 MHz DDR3
    p/n: TW3X4G1333C9DHX G
    product: CM3X2048-1333C9DHX
    Features:
    XMS3 DHX Dual-Path 'heat xchange'
    2048 x 2 MB
    1333 MHz
    Latency 9-9-9-24-2T
    1.6V ver3.2

  • Mac Mini + A1038 Cinema Display does not work

    Hi,
    I have a 2009 model Mac Mini with mini-dvi and mini-display port's on the rear. I can connect any of my DVI based monitors to the mac mini using either the mini-dvi to dvi cable or the mini-displayport to dvi cable. All monitors except for the A1038 model Apple Cinema Display.
    The cinema display works with 3 other computers with DVI ports, turns right on and is detected right away. When plugged into the mini it does nothing. Sometimes I can get it to work with the mini-dvi to dvi adapter but that is sporadic.
    This is the same behavior with a 2009 model mac book pro and macbook. Using the mini-displayport to dvi cable the cinema display does not work but 3 other monitors do.
    So my question is, why does apple hardware only work with non-apple hardware?

    Is the A1038 the old, plastic Cinema Display that doesn't have a power cord or power supply? It only has a video cable with the special ADC on it? If that's the case, it needs this to run from a newer Mac:
    http://store.apple.com/us/product/M8661LL/B

  • My ipad screen is black and will not reset and does not come back after restoring, the info is still on internal because i can see it on itunes in the apps catagory it's the display is not working, can see backlight but black...does anyone know how to fix

    my ipad screen is black and will not reset and does not come back after restoring, the info is still on internal because i can see it on itunes in the apps catagory it's the display is not working, can see backlight but black...does anyone know how to fix, other than take it to apple.
    thanks!

    The wish list only works on apps you have to pay for. To get it tap the icon of the app you want to save. After it opens at the upper right corner is a box with a arrow. Tap that then tap add to wish list list in the box that opens.

  • My thunderbolt display is not working with my MBP retina 13''

    Hi,
         I just received both a new macbook pro retina 13'' and a thunderbolt display. Everything was working properly yesterday but today, I have no clue why, the thunderbolt display is not working anymore.
         . the power supplier for my laptop given by the thunderbolt display is still working;
         . when I don't connect my laptop through the thunderbolt connection, I can use the usb sockets as power supplier , for my phone, for instance;
         . as soon as I plug the thunderbolt cable, the usb socket is not feeding any more my phone, whereas the screen is not displaying anything.
         . If I take a look in the system report, in the thunderbolt tab, there is "no device connected"...
    I restarted plenty of time my laptop, took care to reinitialise the SMC as well as the PRAM, and nothing changed. I also disconnected the thunderbolt display, waited few minutes (and more), but nothing changed, again the black screen.
    Has somebody an idea?
    Thanks

    which model air do you have?
    try both a pram and smc reset
    plug the monitor into a different electrical outlet and a different port on your Mac (if you have multiple tb ports)

  • HT6114 I just updated the last version of OS X Mavericks on my Mac Pro and my Thunderbolt display is not working correctly

    I just updated the last version of OSX Mavericks on my MAc Pro and my thunder bolt display is not working correctly. Could you please help

    Reset the NVRAM/PRAM and Reset the SMC, then try again.

  • 'Program not working' - panorama

    When I attempt to create a panorama using Photoshop Elements 9 on my recently purchased Windows 8.1 pc I get a message saying 'Program not Working' and I have to close the editor. This function was ok on my old Windows XP pc. Can anyone help?

    First, quit the editor, then restart it while holding down ctrl+alt+shift. Keep the keys down till you see a window asking if you want to delete the settings file. You do. Note that if you have set the welcome screen to automatically open the editor, it won't work from that shortcut. Use the actual .exe/application file or the buttons in the organizer or on the welcome screen.

  • My adobe is not working with Windows 7 it says "program not working"

    My adobe does not worked with I have tried 9 & 10 both versions. It does not seem to work with Windows 7.

    Adobe Reader X works very well on Windows 7.
    Please give us the exact error message you're getting; "program not working" is not a message that Windows or Adobe Reader would issue.

  • My iphone 4 fell down from 3 feet height and display is not working now, phone is functioning with calls and messages etc.. except no display :( please advise me a corrective action...

    my iphone 4 fell down from 3 feet height and display is not working now, phone is functioning with calls and messages etc.. except no display please advise me a corrective action...

    Take it to an Apple Store and see about getting an out of warranty replacement. I believe it will run you about $150.

  • Keyboard shortcut for display is not working

    I have an external keyboard because my internal one is damaged, When I set up the keyboard shortcut settings when I first got the keyboard I made sure the display short cuts are set, it worked, though when I changed the short cut values to be something else because it conflicted with a program I am using it stopped working, When I set the shortcut keys back to what I first put them when I got the external keyboard it still did not work.
    I use Macbook air 13-inch, Mid 2011, Software  OS X 10.9.4
    My mac is up to date on this posts time.

    Sorry, I don't have an answer, and I am not a Mac user so not familiar with their problems, but ISTR another Mac use posting with the same issue recently.  Are you using Mavericks?  There are apparently a number of bug issues that the PS team has made Apple aware of.
    But in case that is not the issue here, is this with the Background layer?  Shift F5 works OK for me on a BG layer, but you might find the Del key works better for you.
    Not strictly related, but for other CC users reading this thread, Trevor Morris has released a CC version of his famous Photoshop Keyboard Shortcuts PDF, as well as an Extension that applies a number of custom shortcuts.  I didn't think there were any going spare!   I am also a big fan of the Michael Ninnis Power Shortcuts video from last year's Adobe Max, and there are bound to be conflicts
    Message was edited by: Trevor Dennis  (I forgot the Trevor Morris link)

  • Windows 8.1 some programs not working.

    Some of my programs will not work. It all started with Google Chrome, then Skype, and now I cannot even access my control panel or file explorer. My task bar shows the programs running, but they will not display on the screen. I have tried stuff like SFC
    /SCANNOW on the CMD, rebuild icon cache, and CCleaner, but still cannot find a solution. Please help!

    You will not lose your personal files, as described here in this article: http://windows.microsoft.com/en-us/windows-vista/what-types-of-files-does-system-restore-change
    However, you will need to re-install software. If you have software that costs money, you were provided the license for the software and thus can re-install the software. If it was a 1-time activation software (Really rare) than you should contact the software
    publisher first. 
    However, 99% of purchased software allows you to reinstall. Since it has only been 2 weeks, you likely have not installed much software. However, if you installed allot of software... than I would uninstall software 1 by 1 to remove it. 
    Your malware software did not detect the malware because it might not be malware  but instead it could be software you installed causing this issue. What software did you install 2-3 weeks ago?
    Don't forget to mark the post that solved your issue as &quot;Answered.&quot; By marking the Answer you are enabling users with similar issues to find what helped you. Lewis Renwick - IT Professional

  • 17" LCD Cinema Display does not work on G4 Tower with ATI 9000

    Hi,
    I have a G4 Tower with the original AGP ATI Radeon 9000B video card. My friend gave me this unit just recently but not the original monitor. Well after he got his new 30" Cinema Display he gave me the original 17"LCD Cinema Display. I was so happy, plugged it into the card and fired up the CPU but nothing! just blank! It is not getting any power for the USB ports or anything. My buddy says the monitor was checked before I picked it up. I yanked the Video card out and put it back in, inside the CPU was clean as was the card, put it back together and still nothing. The VGA monitor I have is connected via adapter to the other input and works fine. I tried doing display settings and the Cinema is not even detected. Is the Video card fried on the digital side?
    Do I need a new one?
    Here is the info on the CPU:
    Machine Model: Power Mac G4 (AGP graphics)
    CPU Type: PowerPC G4 (2.9)
    Number Of CPUs: 1
    CPU Speed: 400 MHz
    L2 Cache (per CPU): 1 MB
    Memory: 1.5 GB
    Bus Speed: 100 MHz
    Boot ROM Version: 4.2.8f1
    Serial Number: XB0120xxxxx
    Any help wold be appreciated.

    Hi MFG,
    Welcome to the discussions.
    The G4 AGP Graphics model originally shipped with an ATY Rage 128 graphics card. The ATI Radeon 9000 graphics card that is installed in your G4 is not the original card.
    The ATI Radeon 9000 comes with a native ADC port (which you are trying to use). This port is only fully functional if the computer is ADC enabled. Your model of G4 is, unfortunately, not ADC enabled.
    You can confirm this by opening the computer and having a look at the AGP slot (where the graphics card is installed). In ADC enabled Macs, there is an extra slot at one end of the AGP slot to accomodate an "extra leg" that the ADC graphics cards (such as the ATI 9000) have. This extra leg supplies the power and USB feed. You'll probably find this extra leg with no slot for it to go into.
    What this means is that you are not getting power and USB feed through the ADC port to your display.
    If you want to get the 17" ADC Apple LCD display working off this card (it's definitely the LCD display and not the CRT display, please confirm), you will need to use a DVI to ADC adaptor such as this one:
    http://www.drbott.com/prod/db.lasso?code=0111-DVAD
    and run it off the DVI output.
    You can run your VGA screen at the same time (if you want to) off the ADC output by using this adaptor:
    http://www.drbott.com/prod/db.lasso?code=0117-ADCV
    This will work off the ADC port because, although the ADC port is not getting USB or power feed, it's still getting the DVI feed (which is what this adaptor needs).
    Cheers!
    Karl

  • Keyboard plugs into the back of my display does not work? but when I plug the keyboard into my MacBook Pro it works fine? is it my display Monitor?

    My keyboard plugs into the back of my display monitor it does not work? but when I plug the keyboard into my MacBook Pro it works fine? is it my display Monitor?

    Try:
    - Resetting the iPod:
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - Resetting network settings: Setting>General>Reset>Reset Network Settings

  • Target Display Mode not working iMac 27(2012) Bootcamp to iMac 27(2013)

    Hi All,
    I recently purchased an iMac 27" 2013 which replaced my iMac 27" 2010.
    ===============
    PREVIOUS SETUP
    ===============
    (1) iMac 27" 2012 - Running Windows 8.1
    (2) iMac 27" 2010 - Running OS X Mavericks
    (1)+(2) were connected with a Mini-Display-Port cable.
    (1) was using (2) as external display while (2) was set to Target Display Mode using CMD+F2
    ==============
    CURRENT SETUP
    ==============
    (1) iMac 27" 2013 - Running Windows 8.1
    (2) iMac 27" 2012 - Running OS X Mavericks
    (1)+(2) are connected with Thunderbolt cable.
    (1) can't use (2) as external display anymore becuase CMD+F2 has no effect anymore on (2) in this scenario.
    If (1) and (2) are both running OS X all works as expected.
    I am aware about the support hint from Apple where they state TDM is not working under Bootcamp.
    And I agree, while booted into Windows Bootcamp this machine can't serve as external display. Makes sense because TDM is baked into OS X display drivers.
    Anyone had the same experience and came to a soltuion?
    Thanks,
    Martin

    "Apple has no plans to implement a client driver for Windows since there is no Thunderbolt SW stack available for Windows like there is for Display Port."
    That is a little bit funny since Gigabyte and other big companies have said that 2014 is the year that they are going to implement Thunderbolt in many motherboards.
    "GIGABYTE 7 series motherboards are the very first to offer fully certified dual onboard Thunderbolt™ ports. Capable of connecting up to 12 devices plus 3 digital displays simultaneously with breathtaking data transfer speeds that can transfer 1TB of data in only five minutes, GIGABYTE Thunderbolt™ motherboards offer the fastest connection interface on the desktop PC."
    Have you asked Apple about that? I dont understand why Apple is crippling Thunderbolt on their devices...

  • GS70 miniDP/mini Display Port not working

    Hi forum,
    I recently got a GS70 with 860m graphics that runs win8.1. I can use the HDMI interface with no problems with various monitors. The displays are detected both by the intel software as well as the "change screen resolution" config of windows.
    When I plug a monitor into the miniDP ports however the displays are not detected by the system. I tried this with a 27" Samsung as well as a 30" Dell U3011. I used a miniDP2HDMI cable, a miniDP2DP cable and an active miniDP2DVI adapter, none of them works. I am using the latest Nvidia drivers, they have been updated online through the nvidia experience stuff.
    I tried to troubleshoot this by using an Ubuntu live CD with the same results. HDMI works out of the box as soon as I plug a cable in. Nothing happens when I use the miniDP cable though.
    I also noticed that one cable (miniDP2HDMI) I can put fully into the miniDP port while the other one(miniDp2DP) sticks out 3-4mm and does not seem to go into further even with force. They look alike and the packaging clearly says "miniDP..." though.
    How can I fix this?
    Thanks.

    Quote from: johannes.haase on 09-January-15, 20:16:14
    Hi forum,
    I recently got a GS70 with 860m graphics that runs win8.1. I can use the HDMI interface with no problems with various monitors. The displays are detected both by the intel software as well as the "change screen resolution" config of windows.
    When I plug a monitor into the miniDP ports however the displays are not detected by the system. I tried this with a 27" Samsung as well as a 30" Dell U3011. I used a miniDP2HDMI cable, a miniDP2DP cable and an active miniDP2DVI adapter, none of them works. I am using the latest Nvidia drivers, they have been updated online through the nvidia experience stuff.
    I tried to troubleshoot this by using an Ubuntu live CD with the same results. HDMI works out of the box as soon as I plug a cable in. Nothing happens when I use the miniDP cable though.
    I also noticed that one cable (miniDP2HDMI) I can put fully into the miniDP port while the other one(miniDp2DP) sticks out 3-4mm and does not seem to go into further even with force. They look alike and the packaging clearly says "miniDP..." though.
    How can I fix this?
    Thanks.
    have you tried to press fn + F2 button? some times some displays wont give signal untill you press that button and then laptop one will either go black or go off then on again and then external monitor will wake up and give picture so try it if you havent and then return back to us if it works or not.

Maybe you are looking for

  • Obiee 11g Executing a Direct Database Request in my Dashboard

    Hi Experts, i want to create in my dashboard Button: when i presses Button message will appear with question with 2 buttons :               1 Ok        : will execute Direct Database procedure.               2 Cancel : return to source dashboard. wha

  • Problems installing update PS CS5 on new Windows 7 laptop w/ prior PS vers. already installed

    Hi, When I first got my new Windows 7 laptop, I tried loading PSCS5 onto it, but since it was an update disk, and previous versions weren't there, it didn't load. I finished my work during a 30-day trial period on a recent sabatical, I uninstalled it

  • Graphic design for the web with ID

    If I use ID to create web graphics can I export them without the page background? and if so can I change the page background colour so that I can see white when I am designing?

  • Help - 10.4.4 is driving me nuts

    I know others have had problems - here's mine. Installed 10.4.3 straight from the box - repaired permissions - downloaded Update10.4.4 from Apple - run it and repaired permissions - problems start. The repairs fail to correct permissions on about 100

  • Will aperture convert raw files straight to jpegs

    at present I'm using professional photo shop to do my raw camera shot files, am thinking of buying aperture to use with my brand new all in one desk top mac, but need to know if it will convert raws straight to jpegs?