Handling multiple keypresses

Hi,
I'm trying to code a small race game for 2 players (using the same keyboard). My problem: if the players press too many keys the computer gives a small beep and the game stops for a split-second, which is annoying. How to get rid of that? (To see what I mean: press 6 or seven keys simultaniously for a few seconds...)
Thanks a lot,
Adriaan
PS: The applet looks like this:
public class Game extends Applet implements KeyListener{
addKeyListener(this);
public void keyTyped(KeyEvent e){ }
public void keyPressed(KeyEvent e){
public void keyReleased(KeyEvent e){
}

yeah, i get this same problems... ie, when i hold down one button and keep this button down, then press another button, the application is suppose to detect both keypresses, but doesn't.
in jdk1.0, using the keydown() method worked, but that has been deprecated in jdk1.2. WHY???

Similar Messages

  • IE running under XP can't handle multiple SWF files, Why?

    I noticed that IE 8 running under Windows XP cannot handle multiple swf files in one page.
    Up to about 10 files is no problem they are loaded and we can play them ( buttons that start a small audio file).
    But more of these files in one page will stop IE.
    Firefox ( 3.6.28) runs them fine.
    And also IE 8 and/or Firefox under Windows 7 handles them perfectly.
    Has anyone any idea what can cause this and how to resolve this?
    Thanks,
    Onno Tomson
    The Netherlands

    Sorry...I still don't get it. What is it about Windows FUS that keeps iTunes from running running the process twice? It can run many other non-Apple windows apps in multiple user sessions (commercial apps, open source apps, audio/video apps, networked apps). I can even run two different virtual machines at the same time under two different user sessions.
    Why can iTunesHelper.exe run twice but iTunes.exe cannot? Why can I run Safari at the same time? Quicktime Player runs fine under multiple user sessions.
    Blaming it on Windows and/or FUS sounds like FUD. Can anyone give a valid technical reason? Semaphores? Mutexes? An admission (and explanation) that the Windows version is purposely crippled?

  • Calendar app that handles multiple Google calendars?

    Can anyone recommend a calendar app that handles multiple Google calendars in a single account, including one of what  Google's desktop web site shows as  "My calendar" calendar plus one "Other calendar" calendar?
    Thanks.

    Calendar can have two or more calendars calendars listed at the same time.
    Each can be a different color for identifidation.
    The first screenshot shows that the Medical and Joint calendars are shared calendars.
    Will that work for you?

  • How to handle multiple clients with DatagramSocket

    I am trying to handle multiple clients with 1 datagramSocket bind to one port (basically I have only one port to use, and I can not use TCP or any other ports). At the server side I have two threads one for receiving packets and buffering them, another for processing the packets in the buffer and sending replies.
    I can have multiple clients sending datagramPackets to me and I will have to process the packets and send them to DIFFERENT clients. Ex. Client 1 sends datagramPacket to Server which sends the processed packet to Client 2. Also Client 2 sends a datagramPacket to Server which again processes the packet and sends it to Client1. May have Client 3 and 4 doing the same thing at the same time... and so on...
    My root class is creating the datagramSocket(somePort) and two threads (receiver and sender). How can I use the socket that I created in these two threads??
    I have done the following and I am getting "java.net.bindexception". When I am sending stuff from Client1 to Client2 everything is fine but when I start sending something from Client2 to Client 1, I get the bindexception... Client 1 is using port 3000, Client 2 is using port 4000.
    I really don't have a lot of experience in socket programming so I am not sure if there is a much simpler way to do this. I appreciate all the tips and help that I can get...
    Thanks...
    class UDP_serv
         static DatagramSocket udpSocket;
         final static int SERVER_PORT     = 2000;
         public static void main(String[] args) throws SocketException
              udpSocket= new DatagramSocket(SERVER_PORT);
              new DataReceiver().start ();
              new DataSender().start ();
         static class DataReceiver extends Thread
              DataReceiver()
                   Thread.currentThread().setName("DataReceiver");
              public void run()
                   while (true)
                        byte pckt[] = new byte [MaxMsgSize];          
                        DatagramPacket dp = new DatagramPacket (pckt, pckt.length);
                        try
                             udpSocket.receive (dp);
                             //PUSH TO RECEIVE BUFFER
                        catch(Exception e)
                             e.printStackTrace();
         static class DataSender extends Thread
              DataSender()
                   Thread.currentThread().setName("DataSender");
              public void run()
                   while (true)
                        processDataMsg();
          static void processDataMsg() 
             DatagramPacket op;
             InetAddress DA = null;
             int DP = 0;
             byte [] outPacket = null;
             // POP FROM RECEIVE BUFFER
             // SOME PROCESSING HERE     
             // Set Destination Address (DA)
             // Set Destination Port (DP)
             // DA and DP are the forwarding IP and Port addresses
             // not the addresses original packet was sent from.
             try
              op = new DatagramPacket (outPacket, outPacket.length,DA, DP);
              udpSocket.send(op);
             catch (IOException e)
              e.printStackTrace();
    }Also for development and testing purposes, I am running the two clients and the server on the same machine (windows xp-32b) so all of the Destination IP Addresses are 127.0.0.1. and as I said Ports that I am using are 2000, 3000, 4000 (Server, Client1, Client2).

    Hmm I have minimized the code and it seems to be working now.
    I think I have an error in the header portion of the data I am sending, where I am storing the source IP/Port and destination IP/Port. I think the server in the middle is messing these values up while sending them to the destination Client. Because the destination client actually receives the stuff and sends the reply back to the server, but the reply packet's headers has 0/0 as the dest IP / Port...
    Server is giving me java.net.BindException: Cannot assign requested address error when it tries to forward the reply it received from the client2 as the address it is trying to send is 0!
    I guess it doesnt just give this error when you try to open two sockets to the same port...
    Paul, Thanks for the direction on how to proceed... took me a while get the minimized code but at least figured out the problem. Well still have to make sure that is THE problem though :)
    As far as the statics goes how can I change those to non static ones? Where do I make an instance of the top level class that creates the threads? and how do I pass the DatagramSocket to the threads/ if I dont need to pass how do I call or use the datagramSocket I created in the top level class? I mean do I still kinda have it like a global variable on the top?? A very simple example would be much appreciated...
    I think these might be really basic questions but I am having a rough time with the hierarchy in java...

  • How to handle multiple exception types in JSF 2?

    I'm trying to handle multiple exception types in JSF2, including a default error page for any unexpected exception types. The problems I'm having are:
    1) ViewExpiredException is handled only when no generic exception handler is specified
    2) "Regular" exceptions like NullPointerException are never handled
    My managed bean:
    @Named
    @SessionScoped
    public class MyController implements Serializable {
    /* A method that does nothing */
    public void doNothing() {
        //do nothing
    /* Generate a null pointer exception on purpose */
    public void generateNpe() throws NullPointerException {
        Object x = null;
        x.toString();
    My test page to generate the exception:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Test page</title>
    </h:head>
    <h:body>
        <h:form>
            <h:commandButton id="button1" value="do nothing" action="#{myController.doNothing}" />
            <h:commandButton id="button2" value="generate NPE" action="#{myController.generateNpe}" />
        </h:form>
    </h:body>
    </html>
    My web.xml:
    <!-- Redirect all NPEs to this page; this never works! -->
    <error-page>
        <exception-type>java.lang.NullPointerException</exception-type>
        <location>/error/error003.jsf</location>
    </error-page>
    <!-- Redirect all VEEs to this page; this works fine if the next section is excluded -->
    <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/error/error002.jsf</location>
    </error-page>
    <!-- This grabs everything, even with the previous sections defined.  If I exclude this error-page section, VEE works fine but NPE still does not get redirected -->
    <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/error/error001.jsf</location>
    </error-page>My questions are as follows:
    1) How can we handle "regular" java exceptions like NPE?
    2) How can we define a catch-all for unexpected exception types, while still respecting specific exception handlers for VEE, etc?
    Thanks,
    Benjamin

    Is your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
    However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
    Cheers,
    Peter.

  • How to handle multiple tables data in Entity Beans?

    How to handle multiple tables data in Entity Beans?
    i mean, my bean (non trivial) is responsible for frequent
    insertion in one table and some deletion on another table.
    Can anyone of you...please..?

    Is your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
    However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
    Cheers,
    Peter.

  • How to handle multiple datasources in a web application?

    I have a J2EE Web application with Servlets and Java ServerPages. Beside this I have a in-house developed API for certain services built using Hibernate and Spring with POJO's and some EJB.
    There are 8 databases which will be used by the web application. I have heard that multiple datasources with Spring is hard to design around. Considering that I have no choice not to use Spring or Hibernate as the API's are using it.
    Anyone have a good design spesification for how to handle multiple datasources. The datasource(database) will be chosen by the user in the web application.

    Let me get this straight. You have a web application that uses spring framework and hibernate to access the database. You want the user to be able to select the database that he wants to access using spring and hibernate.
    Hopefully you are using the Spring Framework Hibernate DAO. I know you can have more that one spring application context. You can then trying to load a seperate spring application context for each database. Each application context would have it's own configuration files with the connection parameters for each datasource. You could still use JNDi entries in the web.xml for each datasource.
    Then you would need a service locater so that when a user selected a datasource he would get the application context for that datasource which he would use for the rest of his session.
    I think it is doable. It means a long load time. And you'll need to keep the application contexts as small as possible to conserve resources.

  • How to handle multiple actions in the webservice ?

    Hi Guys,
    I have multiple operations in the webservcie and under soap action in the receiver soap adapter, i dont know how to handle multiple soap operations.
    can anybody guide me, how to acheive this ?
    Thanks,
    srini

    Hi Srini !
    This weblog shows the general design of a scenario with BPM
    /people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm
    This link:
    http://help.sap.com/saphelp_nw04/helpdata/en/de/766840bf0cbf49e10000000a1550b0/content.htm
    show how to insert a predefined BPM pattern. You could use one of the BpmPatternSerialize.... patterns to see how you BPM should look like...
    Basically it should be:
    1) Receive Step (async/sync, as you need) to trigger the BPM
    2) Send step (sync) for first webservice
    3) Send step (sync) for second webservice
    N) Send step (sync) for N webservice
    N+1) if the whole communication is sync, here you need to use a send step to return back the answer to sender.
    Regards,
    Matias.

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

  • How to handle multiple request in the servlet

    how to handle multiple request in the servlet...
    Example:
    java forum...
    i'm login in the java forum at this time 1000 members make login in this....how happended in servlet?
    if we use thread how to implement in servlet ?

    Serlets are already threaded. The application container instantiates the servlet, then uses this instance in a new thread for every use.
    This is the reason that you should use (almost) no instance variables in a Servlet, but rather that (almost) everything should be local to the method.

  • How to handle multiple attachments in XI mail sender adapter?

    Hi,
    is it possible to handle multiple attachments in a mail receiving in XI?
    Our customer wants to send us mails with multiple attachments and we have to convert each attachment to an idoc.
    But as I know XI (receiving mails) can handle only a single attachment in a mail. Is it true?
    Any ideas?
    Thanks a lot!
    Regards
    Wolfgang

    Hi Wolfgang,
    Well, although I have never tried a scenario of picking more than two attachments from one mail, I wonder if its possible in the first place!
    Here are the reasons why I think it is possible:-
    It is not mentioned anywhere in the SAP Notes for mail adapter that it is not possible.
    *It is not mentioned anywhere in the SAP help documentation that it is not possible
    *Also, I think if the receiver mail adapter can create more than one attachment, the sender should be able to pick more than one!:)
    Have you tried defining a PayloadSwapBean module to pick up more than one attachment?
    Just try experimenting with this particular part of the module code:-
    Content-Disposition: attachment;filename="MailAttachment-1.xml"
    Content-Description: MailAttachment-1
    I think even the following weblog might be able to help you to a certain extent:-
    "Receiving E-Mail and processing it with ABAP - Version 610 and Higher" - /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
    Regards,
    Sushumna
    Regards,
    Sushumna

  • Sender ebXML Adapter for handling multiple documents

    Hi all,
    I would like to ask for input on how to implement the use of sender Seeburger ebXML channel that will send multiple documents types (CIDX ordercreate and CIDX orderchange).
    For Seeburger AS2 adapter, handling of ANSI X12 documents (EDI850 and EDI860) can be done using Generic AS2 sender and Split997 adapters, and message splitter configuration. Is there same functionality that can be used for sender Seeburger ebXML adapter for handling multiple non-ANSI X12/EDIFACT documents like CIDX OrderCreate and CIDX OrderChange?
    Thanks,
    Edward

    Hi,
    Can we hit 100 Email ids to read email using single mail adapter?
    no, you have to configure url / authentification in the adapter what is obviously different for different ids.
    Can we achieve it using standard module?
    Do we need to develop custom module to read emails from 100 mail ids?
    You don't need module, you need 100 sender channels.
    /Udo

  • MVC �Best Practice� (handling multiple views per action/event)

    Looking for the best approach for handling multiple views for one action/event class? Background: I have a small application using a basic MVC model, one controller servlet, multiple event classes, and multiple JSP views. For performance reasons, the controller Servlet is loaded once, and each event class is an instance within it. Each event has an �eventProcess()� and an �eventForward()� method called by the controller, standard stuff.
    However, because event classes should not use instance variables, how should I communicate which view to forward to should based upon eventProcess() logic (e.g. if error, error.jsp, if success, success.sjp)? Currently, there is only one view mapped per event, and I'm having to put error handling logic in the JSP, which goes against the JSP being for just view only.
    My though was 1) A session object/variable that the eventProcess() sets, and the eventForward() reads, or 2) Have eventProcess() return a mapping key and have the conroller lookup a view page based upon that key, as opposed to 1-1 event/view mapping.
    Would like your thoughts!
    Thanks
    bRi

    Your solution seems ok to me, but maybe the Struts framework from Apache
    that implements MVC for JSP is a better solution for you:
    http://jakarta.apache.org/struts/index.html
    You should take a look at it. It has in addition some useful taglibs that makes life much easier.
    We have successfully used it in a project with about 50 pages.

  • How to handle multiple site to site IPsec vpn on ASA, any best practice to to manage multiple ipsec vpn configrations

    how to handle multiple site to site IPsec vpn on ASA, any best practice to to manage multiple ipsec vpn configurations
    before ver 8.3 and after version 8.3 ...8.4.. 9 versions..

    Hi,
    To my understanding you should be able to attach the same cryptomap to the other "outside" interface or perhaps alternatively create a new crypto map that you attach only to your new "outside" interface.
    Also I think you will probably need to route the remote peer ip of the VPN connection towards the gateway IP address of that new "outside" and also the remote network found behind the VPN connection.
    If you attempt to use VPN Client connection instead of L2L VPN connection with the new "outside" interface then you will run into routing problems as naturally you can have 2 default routes active at the sametime (default route would be required on the new "outside" interface if VPN Client was used since you DONT KNOW where the VPN Clients are connecting to your ASA)
    Hope this helps
    - Jouni

  • XML IDOC data (hosted on a web server)   &  handling multiple WSDLs

    Hi ALL,
    1)how to design an Interface for picking up an XML IDOC data (hosted on a web server) which will be uploaded to SAP or converted to a file
    this is what the customer has given me ..can any one explain me this and help me how to more forward
    2).This Interface must use UDDI concept because we are going to use multiple BAPIs /RFCs as WSDLs
    what is this mean can any send me some document on this
    3).Use web-service navigator concept as we will be handling multiple WSDLs
    i worked on 1. to define a place holder in WebAS for holding the
    wsdls.
    2. publish the wsdls in WebAS UDDI Repostory
    but i have never used web-service navigator concept as we will be handling multiple WSDLs what is the difference ..send me some step by step docs ..
    thanks very much
    RK..

    1.I am not clear with the requirement too. THere is no big deal in sending XML to IDOC or File. Based on your requirement you have to import IDOC structure or ify ou are using file, create a structure for the file.
    If u are asking about sendin the XML directly without mapping, even you can do that without MM and even IM.
    Please be more elaborate and if you are not clear with what client said, paraphrase them or ask again. Its not good to start work unless we are very clear with the requirement.
    you can say to my understanding i feel this, now pI will send data like this. Is it correct?
    2. More information on UDDI
    http://en.wikipedia.org/wiki/UDDI
    I dont think you need to worry much about this now with many features provided in ESR especially
    3. http://<Host>:<port>/wsnavigator/
    The webservices going out of PI are published here.
    provide host and port are host and port details of ext system.
    Once you enter link in your browser, it shows the available webservices hosted there.
    All you need is to click on the required wsdl and test it.
    It is as good as sending your data from PI to other system.
    It is similar to Altova XML spy but the difference here is you enter the values directly here but in XML spy we send XML .

Maybe you are looking for