Stop Enter key for acting in a JTable

I am having some problems with scrolling because of the Enter key. I there a way to override or stop the enter key from acting in a JTable?

The following code simulates a mouse click on a cell when enter is pressed. You should be able to change it to do nothing, or add other functionality.
table = new JTable(model)
     protected void processKeyEvent(KeyEvent e)
           if ( e.getKeyCode() == KeyEvent.VK_ENTER
           &&   e.getID() == KeyEvent.KEY_PRESSED )
               int column = table.getSelectedColumn();
               int row = table.getSelectedRow();
               Rectangle r = getCellRect(row, column, false);
               Point p = new Point( r.x, r.y );
               SwingUtilities.convertPointToScreen(p, table);
                try
                     Robot robot = new Robot();
                     robot.mouseMove(p.x, p.y );
                     robot.mousePress(InputEvent.BUTTON1_MASK);
                     robot.mouseRelease(InputEvent.BUTTON1_MASK);
                     robot.mousePress(InputEvent.BUTTON1_MASK);
                     robot.mouseRelease(InputEvent.BUTTON1_MASK);
                     robot.mouseMove(0, 0 );
                catch (Exception e2) {}
           else
               super.processKeyEvent(e);
};

Similar Messages

  • Is There a List of Keyboard Shortcuts for Adobe Digital Editions, I Found Two By Accident the "Arrow" Keys and the "Enter Key" for Turning Pages in an eBook...

    Hi  ??  :       Does Anyone Know If There is a List of Keyboard Shortcuts for Adobe Digital Editions, I Found/Discovered Two By Accident the “Arrow” Keys and the “Enter Key” for Turning Pages in an eBook...   Thanks
    I Did Look for this Keyboard Shortcuts in Adobe Digital Editions Help & FAQ Areas and Got the Run Around, Very Hard to Find How Use Adobe Products !!
    Microsoft Windows Vista & Win 7 Operating Systems
    Message was edited by: Al Adams

    Nope, I doubt it.  As I said:
    I disabled Aero theme, checked font scaling was 100% and rebooted Windows in between all of the steps to no avail.
    I've been reading a lot around this and it seems the arrow key problem is a red herring; I think it's just some kind of terminal preferences corruption.

  • Enter key to act like tab key in JTable

    I have programmed a JTable application. I want that if I press 'Enter' key in the JTable cell, the cell at right side may be selected after validating input. Similarly, when I press 'Enter' in the right most cell, the first cell of the next row may be selected after validating input.
    In other words, I like 'Enter' key to behave as forward navigational key in JTable cells like 'Tab' key, however, after validating input.
    The following is the piece of code which is not working for me. Though, it changes selection border to the next cell on pressing enter, but the focus is not shifted and editing remains in the current cell.
    //voucherTable is a JTable object with three columns.
    Action moveForward = new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
    int r=voucherTable.getSelectedRow();
    int c=voucherTable.getSelectedColumn();
    if(c==2){
    c=-1;
    r+=1;
    voucherTable.changeSelection(r,c+1,false,false);
    voucherTable.getInputMap().put(KeyStroke.getKeyStroke
    (KeyEvent.VK_ENTER,0),"moveForward");
    voucherTable.getActionMap().put("moveForward",
    moveForward);
    Kindly advise me to solve the problem.
    Thanks.
    Mujjahid

    KeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
    KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    InputMap im = table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    im.put(enter, im.get(tab));

  • Where can i buy an enter key for a macbook pro 13" mid 2010?

    I accidentally messed up my enter key, and i believe i just broke the little thing that holds the metal bar or something...
    i was wondering where could i buy a replacement for it.
    thanks in advance

    Replacement keycaps can be found at replacementlaptopkeys.com.
    There is a YouTube instructional video on how to replace the keycap here:
    http://www.youtube.com/watch?v=JjRTQIfVTgU

  • 'ENTER' key for Submit Button

    Hi,
    I have 1 inputfield , 1 dropdown and 1 submit button in a page. I want to execute submit button always when you click 'ENTER'.
    Now when i click enter from inputField it process something and in background there is no event triggered.But from dropdownbox nothing happens when i click 'ENTER' key.
    Is there any way to assigne 'ENTER' key to the submit button(<htmlb:button) always?
    Thanks in advance
    AP

    Hi,
      It looks like SubmitOnEnter is not available in my verions of htmlb. I just looked into some javacode,
    I have 2 page, Initial and Report,
    Initial page has the code,
    <script>
    document.onkeydown=function(){
    if(event.keyCode==13){document.forms.initial.submit()}}
    </script>
        <htmlb:form id     = "initial"
                    method = "post"
                    action = "Report.htm" >\
          <htmlb:inputField id            = "TranNumber"
                            type          = "string"
                            value         = "<%= INIT-TranNumber %>" />
          <htmlb:button id      = "SUBMITVALUES"
                        text    = "EXECUTE"
                        onClick = "HandleSubmit" />
    </htmlb:form>
    Report page captures it as,
    CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
    IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
      DATA: EVENT TYPE REF TO CL_HTMLB_EVENT.
      EVENT = CL_HTMLB_MANAGER=>GET_EVENT( runtime->server->request ).
      IF EVENT IS NOT INITIAL.
        CASE EVENT->ID.
          WHEN 'SUBMITVALUES'.
            DATA: TranNumber TYPE REF TO CL_HTMLB_INPUTFIELD.
             TranNumber ?= CL_HTMLB_MANAGER=>GET_DATA(
                          request = runtime->server->request
                          name    = 'inputField'
                          id      = 'TranNumber').
        ENDCASE.
      ENDIF.
    ENDIF.
    Basically the no event is not fired. so it is not coming into the Case.
    How to handle this?
    Thank you
    AP

  • Stop enter parameter for report instance

    hello everyone:
    I have a problem when i schedule one of my report:
    this report contains a few parameters
    when i schedule it, i pre-enter the parameters' value (at schedule -> parameter panel)
    after report finish to run, the report instance gose to user's inbox.
    the problem is:
    when user try to view the report instance in their inbox, infoview ask user to enter parameter again. it only appear first time user view the instance, if user close the report and reopen it , it will skip the enter parameter step and get into the report stright away.
    any ideas to stop it?
    thanks

    Hi,
    Here are the steps :
    Go to CMC > Select  Report >click on Schedule report > click Default Settings option > Under Paramter Option > Uncheck Prompt While vewing Option > Save
    Now enter the parameters and Schedule the report to the following destination.
    Hope this will resolve the issue.
    Regards,
    Rameez
    Edited by: ramzraja on Aug 23, 2011 7:22 AM

  • The "Enter" key keeps starting and stopping itunes songs...

    Hey, everytime I hit the enter key for example in Safari to enter a webpage, my itunes songs keep starting and stopping like I have the itunes window active... Does anyone know a solution for this? I tryed reinstalling and no luck...
    Thanks

    What are the system specs for your pc? It seems it's to slow to play iphone's 720p HD videos. QT 7.7.3 is the latest for windows but VLC Player will play these videos too.

  • Space bar acts like enter key

    I'm editing along playing my clip. I want to stop play, so I hit the space bar. The play stops but my CTI also returns to the beginning of the timeline (that I don't want) I've got the enter key for that. I've looked at key shortcuts and the space bar is assigned to play,stop toggle. That's what I want it to do but it also goes back to the start of the timeline. Then I have to hit the end key to get back to where I am actively editing.
    Anyway to fix this? I tried clearing the shortcut and reassigning it but still get the unwanted action.

    You will see this behavior when the CTI goes beyond the end of the video--it leaps back to the start, if you're not fast enough to stop it before the end
    What I have done when this gets annoying is to place a clip of black video beyond the editted end of the track--this gives me time to stop the playback before the jump to start

  • Submitting a form with enter key causing strange problems

    I am having a very strange problem with a webapp I am currently developing. I am using JSF 1.2 along with Facelets and RichFaces. I have coded a workflow/wizard 4-step process, and on some pages I have 4 submit buttons that all call different actions on the page. The users thought it would be useful to have the enter key submit the form, so I followed some online resources to trap a keypress using javascript, looking for the enter keycode and calling document.getElementById("elementName").click(). This works fine most of the time. Sometimes, though, it seems as if an entire new session is being created, and odd behavior starts happening. For example, my page will only include 2 of the 4 facelets on the screen -or- I will get NullPointerExceptions for objects that I know have been created in the session bean I am currently using -or- I will get a duplicate form Id after trying to re-submit the page. Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"? I'm really at my wit's end here (plus it's nearly 3 AM, that never helps things). All of the buttons being clicked are standard h:commandButtons. There is some setTimeout logic included to disable the buttons on the page to prevent double clicks (I cannot disable them onsubmit because disabled buttons don't pass the right values, perhaps that's causing it, but if so, clicking the buttons with the mouse would cause that issue too, right?)
    I am not posting the code (yet), but if anyone wants to take a look see and see if I am doing something really abhorrently wrong, I'm more than willing to, I'm just curious if anyone has had problems regarding javascript submission of forms via the click() method. Clicking the button does not exhibit this type of behavior. Just as a side note: I am doing different things with the enter key depending if a modal window is open (the enter key closes the modal if it's up, and if not, it submits the form via a button click).
    Any help is much appreciated, if anyone has any inkling about where I should start looking for answers it would be really helpful.
    Thank you.

    edfrost wrote:
    Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"?My guess is the second of these. You need to suppress the event handling after programmatically clicking the button.

  • Restrict clicking enter key in the bdc program

    Hi all,
             There is one BDC program for Vendor Master creation. In the output it is waiting for the enter key for each vendor creation. Suppose we have 1000 vendors to be created. Then we need to click enter key 1000 times.
    Anybody please suggest me whether can I change the BDC code to stop entering the Enter Button each time a vendor is created.
    Thanks and Regards,
    Murali Krishna T

    Hi Raghava,
                        Thanks for your prompt reply. There are no information messages inside the loop.
    This is the code block inside the loop.
      Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    Edited by: Rob Burbank on Apr 23, 2010 10:26 AM

  • Flex4.5 SDK under Flash builder Burito doesnt dispatch Enter key event in Text Area anymore

    Flex 4.5 under Flash builder Burito doesnt dispatch 'Enter' key event in Text Area anymore, in prev version 4.1 it was working properly, this stopped working after migration to Burito + Flex SDK 4.5?
    What that suppose to be?

    Hi
    That's true that Flex4.5 SDK under Flash builder Burito doesn't listen Enter key in Text Area for KeyUp or KeyDown event.
    Here I found a work around you can use.
    Add an eventlistener to the component in actionscript and set the useCapture=true next to eventlistener function. Now you can listen enter key for KeyUp or KeyDown Event
    Hope this helps
    Rush-me

  • Navigation using 'Enter' key

    hi everyone
    I would like to ask if there is a way to make navigation between text fields possible by 'ENTER' key.
    for example if we have a tabular form and we want to navigate between fields by 'ENTER' exactly like the 'TAB' key, is it possible??
    Thanks alot
    Regards

    Hello,
    Please check if the following can help you - Tabbing between application fields .
    Regards,
    Arie.

  • Disable ENTER KEY on text item

    All,
    I am trying to disable SUBMIT on ENTER KEY for a text item on a page as below but still its submitting how can i achieve this.
    I want the page to totally disable the enter key so when i press ENTER KEY nothing happens,
    what i did:
    1. when page loads,
    $("input").keypress(function evt) {
    var charCode = evt.charCode || evt.keyCode;
    if (charCode  == 13) {
    return false;
    2.
    Submit when Enter pressed
    NO
    APEX 4.2
    thank you.

    Hi,
    Your code is not valid.
    I'm sure it raises errors.
    Place to page JavaScript -> Execute when Page Loads
    $("input,select").keypress(function(e){
    return e.keyCode!==13;
    Regards,
    Jari

  • Document addition on pressing Enter Key

    Dear all,
    I want to know whether it is possible to restrict document addition by pressing Enter Key at first time.
    What i want is if user press enter key for first time to add document the system should generate message as generated in Invoice  so that document is added after message.
    This is because many users are use to legacy system where they regularly press enter which creats error in new system.
    Is it possible ..??
    swap

    There is an add-on called B1UP.
    It has so many cool features.
    When you press enter it takes you to the line level and does not add the document.
    Thanks,
    Joel

  • Pressing Enter key twice should submit the form

    I am trying to enter the chinese characters in the text box, chinese chracters will become a whole word only when we press the Enter key. But after entering a chinese character , if I press the enter key then the form got submitted. Instead the form should get submitted only when we press Enter key for the second time.
    Is it possible with Javascript?

    karthi23 wrote:
    I am trying to enter the chinese characters in the text box ...Where? An Java application? Your browser?
    Is it possible with Javascript?This is a Java forum. JavaScript and Java are two completely different things. You better find a JavaScript forum to ask this question.

Maybe you are looking for

  • Oracle 10g expdp fatal error (ORA-39125 & ORA-01801)

    Key phrases: ORA-39125 ... DBMS_METADATA.FETCH_XML_CLOB [TABLE_STATISTICS] ... date format is too long Hello, While performing a routine export (expdp) of schemas in an Oracle 10.2 instance on Linux, a fatal error (ORA-39125) was genereted. A screen

  • Media import problem

    Hi I'm very new to this so please bear with me! I'm having problems downloading avi movie files into Premier Elements 10. I have tried a couple of clips with the same result. The clip is only partially imported, I have one that is apprx 30 mins long

  • IS Mill functionality in ECC 6.0

    Hi experts, I wanted to use an IS mill specific functionality of PRT capacity planning in ECC 6.0. How can I do this?. Is it possible to activate only this functionality of IS Mill in ECC6.0. Is there any implication by doing so? Request you please r

  • Translated table HR_LOCATIONS_ALL_TL Question

    I would like to know the difference between language and source_lang columns on the table 'hr_Locations_all_tl'. Both columns hold the same data with 'US' language. Do we need to look only LANGUAGE column or both columns when querying? Will this ever

  • Lenovo s820 not recognized in computer

    I am using lenovo s820 for the past 1.5 years. Recently I upgraded it to KitKat OS and post which I'm not able to connect it to computer. Though the usb cable if fine, cell is not recognized by any computer.  I've tried other cables as well as with o