Trap enter key? please help

how will i trap the enter key?
example: jTextField1 has the focus or insertion point, if the user presses the enter key from the keyboard the next focus or insertion point will be on jTextField2.
thank you in advance.
killuasoft

Swing related questions should be posted in the Swing forum.
By default a "Tab" key is used as the "focus traversal key". You can also add the "Enter" key as a focus traversal key to any given component.
I'll let you read the Swing tutorial for information on how to do this.

Similar Messages

  • How to trap ENTER Key ????

    I am doing setup wizard in my project. I trapped Enter key, if i press enter key to go to next screen, The behaviour of my wizard is unpredictable.

    The same goes if you have a text field(s):
    final JTextField tname = new JTextField(30);
    final JButton ok = new JButton("OK");
    tname.setText(nodeName);
    tname.setMinimumSize(new Dimension(50,10));
    tname.setSize(new Dimension(70,10));
    tname.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {  //action on JTextField - pressing Enter
    ok.doClick(); //or whatever you like
    cp.add(tname);
    cp.add(ok);
    ...

  • Problem with Logic XS Key, PLEASE HELP

    I use my G4 Powerbook laptop for live. I am running most recent version of logic.
    What happens is that Logic will load up fine, but then for no apparent reason logic will come up with an error message saying that the logic key has been removed, but i have not touched it!! I then have to restart logic.
    PLease help i have to get this sorted ASAP cuz i have a gig tomorrow nite. Cheers guys

    Hmm, it does it on both USB ports? And you haven't noticed any problems with other USB gear on those ports?
    When the key is next not recognised by Logic, go into the system profiler and find your USB port that the XS key is on - the XS key will be labelled when it's functioning correctly. Is it still recognised by the computer, or has it gone completely?

  • CMP with auto-increment primary key.Please help

    Hi all,
    I new with EJB technology so please bear with me.
    Env: 2k Server, SQL 2k Server
    Sun One(Forte EE) to develop and deploy CMP
    I got the servlet to load the data from CMP's business mehods
    is fine. Calling the findPrimaryKey is OK too. Even when I try to insert the row into DB is OK. At this time I make key PK is int AND NOT
    AUTO INCREMENT everything is OK. In the ejbCreate method
    I called setPK, setName ...It's fine.
    The problem comes when I try to make the PK(still int) to be auto-increment field.In ejbCreate not call setPK because of in SunOne IDE, under the J2EE RI tab of EJB Module property, the Auto generate SQL I set to false so that I can
    modify the SQL statement under SQL Deployment.createRow not taking the PK. I thought that will do it but it doesnot like it at all (I got Exception with transaction rollback)I just want to insert a single row with ID and name that's all.
    Then I changed the SQL statment take PK and changed the Auto Generate SQL to True and in ejbCreate the PK as one of the args and called setPK this time with null object. It doesn't like neither.(Exception Cannot set the primary key with null. That is reasonable.)
    I thought using EJB fast and clean technique would help developer to develop application with easiness.
    So I realy stuck with this, I wonder ejb 2.0 support for auto increment at all because I would like to take advantage of the auto increment feature of the DB without writing the PrimaryKeySequence generator at all.
    Am I missing something with this? May be just config thing to tell
    that my PK is auto-increment field so that when the ejbCreate called it knows not taking the PK or even not asking to call setPK in ejbCreate.
    Any help would appreciated.

    Check out this thread, there's a bunch of good info:
    http://www.theserverside.com/patterns/thread.jsp?thread_id=4976

  • Forgot WAP key,please help!!!!

    Ok,I use WRT150N model,and windows vista  if it helps...
    I'm connected at this moment,but I want to connect my PS3 wirelessly,the problem is I totaly forgot my SSID  and WAP key,I searched the whole apartment and can't find my notebook where I did put that info. ,how can find this info. on my PC,or what software may help...
    Please explain step by step,I'm reanot that good with computers! ^_^

    have you changed the router's password, if you have type it in. if you haven't, restore to factory settings by pressing reset button(at the back, red color) for 30 second and let it reboot. type 192.168.1.1 and again username blank password admin
    this will put your router in factory default, which means all your settings will be lost.
    Message Edited by luimar on 09-03-2008 05:37 PM
    l. ceron

  • Multiple Values per Key - PLEASE HELP!!

    hi. im trying to setup a TreeMap so it contains multiple values for each key using a List to store these values and a string as a key to reference them. however, although it compiles, i recieve a ClassCastException: java.util.ArrayList error when it runs. heres some of my code:
    Map resultRelation = new TreeMap();
    List list = new ArrayList();
    list.add(value1);
    list.add(value2);
    resultRelation.put(Key, list);
    i cant seem to find much useful information on this sort of thing. any help would be appreciated.

    well after hours of labouring, it turns out that the code i posted is working but the problem is actually to do with printing out the values stored in the array. it was rather stupid of me but before i had created a print method which printed the key and its value from the map, assuming the value was one string not a List, and i hadn't updated it =) so the ClassCastException error was occuring because i was trying to cast the value (which is really a List) to a string in order to print it.
    heres my updated printRelation method code as follows:
    private static void printRelation(Map relation) {
    Iterator keyIter = relation.keySet().iterator();
    Iterator valueIter = relation.values().iterator();
    while(keyIter.hasNext() == true) {
         String primaryKey = (String)keyIter.next();
         List foreignKey = (List)valueIter.next();
    ConsoleIO.out.print(primaryKey); // ignore the ConsoleIO stuff. the key prints no prob.
    Iterator iter = foreignKey.iterator();
    while(iter.hasNext() == true) {
    String value = (String)iter.next();
              ConsoleIO.out.print(value);
    at the moment im only adding 1 value to the List as shown in my previous post. e.g.
    list.add(foreignKey1);
    all this works BUT im getting the wrong results. instead of printing out the key and only its values, its printing out the key and ALL the values from the text file im using. i think its either got something to do with my while loop or my casting of the List but this is all new ground for me =)
    thanks.

  • Missing key - please help

    Hi!
    I have one nokia phone (unfortunately I don't know the model number), which is very durable and I have it more than 5 years. Recently I lost one key and temporarly I replaced it with M3 screw:
    Now I would like to find spare rubber to replace that screw, since it's sharp and not comfortable to carry in pocket. Doeas anyone know if such rubber keys are available as spare parts?
    I don't want to buy new phone, since it is still working.
    Regards,
    Marko

    if you post a screen shot of phone of phone we can direct you to replacing parts ,or type in *#06# on phone it will give you model number
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • The site addresses what I'm on keep getting replaced with "search or enter address" please help

    whenever I open a new tab the site address is replaced with "search or enter address" and automatically prepares me to type in the address. this means I can't copy the site address of the website I'm on as there is nothing I can copy.

    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • Itunes wont Install, could not find key, please help.

    Every time I try to install the new itunes I get an eroor, I have a screen capture of it here:
    http://i10.photobucket.com/albums/a141/lilyphotos/error.gif
    I just bought a new ipod and it only works with 7.0. I'm pretty much ready to throw my computer out a window...

    That's an unusual key to be having cited under these circumstances. It looks to be a problem down in your downloaded applications area.
    Are you installing iTunes from an account with full administrative privileges?

  • Fn key please help???

    Apple of course had to place the Fn key where the ctrl button should be, this ***** for me as i have Windows XP using bootcamp on my MacBook Pro and i need to hit ctrl to crouch in games. It is in a hard spot to hit and I would like to switch the Fn and left ctrl key. Is there ANY way to do this in Windows I've tried every software I could find and nothing recognizes the Fn key so i can't remap it. Does any one know of a way to do this. I would appreciate it greatly, Thanks.

    woops maybe i should read the whole post before i write lol sorry you already tried that
    you can always use an external keyboard set up like windows keyboard that may work
    Message was edited by: demolasko

  • Logic 8 will only open with old XS Key-PLEASE HELP!!!

    Hi all,
    I have just installed logic studio (upgrade) on my new mac.
    For some reason it needs my logic 6 xs key to start up every time.
    I have used it on my other macbook pro with no problems at all!
    I have tried the directions given here;
    http://support.apple.com/kb/TS1106
    But it still doesn't work.
    Any suggestions???
    Is it a 10.5 issue??? It has always worked on my older macbook pro with 10.4!

    So if you have followed that article completely and it still doesn't work you may have an issue with your file system. Delete your current System ID and then use Disk Utility (Located in /Applications/Utilities) to Repair Permissions on your system volume and also use the Verify Disk feature as well to determine whether the volume needs repairing. For info on how to repair an OS X volume see here: http://support.apple.com/kb/TS1417
    Once permissions are repaired and or volume verified/repaired try serializing Logic again.
    Also if you did not, be sure that the software gets installed using the installation discs and not dragged over from another system. Also here: http://support.apple.com/kb/HT2375 is instructions on reinstalling Logic Pro if the above steps do not resolve your issue. See bottom of article.
    Cheers

  • Clearing the TextArea texts when I press Enter key

    How to clear the texts that I have typed into the TextArea when I press Enter Key?
    I have now added a TextArea instance called input_txt to the stage and added an component event listener to detect when I press enter key. Then an event fires up which first reads the input to a string variable.
    But next I need to automatically clear the texts in the TextArea.
    How to do that?
    function readInput(event:Event):void
        input = input_txt.text;
        trace(input);
        // removing texts in the text input area-------- how?
    input_txt.addEventListener(ComponentEvent.ENTER, readInput);
    Please help.
    Thank You

    ComponentEvent.ENTER occurs before the line feed is added to the text, and is not cancelable, so you'll probably need to set a flag and do the clearing in an Event.CHANGE handler. Something like this:
    import fl.events.ComponentEvent;
    input_text.addEventListener(ComponentEvent.ENTER, readInput);
    input_text.addEventListener(Event.CHANGE, changeHandler);
    var clearing:Boolean=false;
    function readInput(event:Event):void
        input = input_txt.text;
        trace(input);
        clearing=true;
    function changeHandler(event:Event)
    if(clearing)
      input_text.text="";
      clearing=false;

  • Upload file in to SAP for 'ENTER' key delimited

    Hi SAP gurus,
    I have one issue while uploading the textfile into sap the file is contains 16bit char i.e. chinese char and req is as below
    there are many records in the file and i need to identify the next record by identifying ENTER key pressed.Insted of TAB key here its a ENTER key
    so please tell me how to achieve this i am using GUI_UPLOAD to upload text file.
    I want to identify where the enter key is pressed in the text file by reading ascii value of ENTER KEY will help me to find the starting of second record .
    The file format is as follows
    mmmm~~??????
    1~20110101~20111231
    //???: FIRST RECORD
    0~00130698114013434412011042604823700000913.030.172.22TestingCustomer310104120000000???????????????130601000000000??????532611-3357211??~~~
    0~CECLOR SUSP125EA13.030.172.2213.030~1510 FROM HERE SECOND RECORD its came after pressing enter
    1~0013069811401234512011042604823700001013.030.172.22Testing Customer310104120000000???????????????130601000000000??????532611-3357211??~~~
    0~CE125 6 XEA13.030.172.2213.030~1510
    Thanks
    Nirmal

    Are you sure that it's a ENTER key and not CR or CRLF (hex 0D0A)? 
    If it is CRLF (carriage return-line feed, you can check by looking at the Hex value of the string), you can split as described in this thread:
    How do I TRULY remove the CRLF (#) from the last field read in CSV dataset?
    Or see the  class: cl_abap_char_utilities=>NEWLINE or FORM_FEED for other possibilities. 
    for instance: 
    do.
    split (your input line) at cl_abap_char_utilities=>newline into line.
    if sy-subrc ne 0.
    exit.
    endif.
    append line  to internal table.
    enddo.
    The easiest way to process this would be to have the file come to you as lines of data with horizontal tab delimiters, without those multiple tildes, since that's something else you will have to deal with.
    Edited by: DaveL on Aug 1, 2011 7:58 PM

  • Export specific records from all table? Please help me with my query

    hi
    there are around 200 tables, I want to take a export of all tables of xyz schema.
    My requirement is just a few records of primary key and their relevant records from other tables to be exported by using exp or expdp utility.

    Hi Toni...
    Thanks for your reply.
    Could you please help me understand how to user this expdp query...
    and what exactly should i mention in the parfile. I want all relevant records from all tables of primary key. please help me to write a query accordingly.

  • Photo Book purchase question please help!

    Ok well I made my photo book but I don't know how much it will cost to buy it. Is it always the same price? Or will it tell you after you're finished making you're photo book. Also when I am finished with my photo book and I hit "Buy Book" will it buy it right away? Or will it say blah blah blah this is how much it will cost ok? Do you agree? Are you sure? Enter information PLEASE HELP

    I just received my first IPhoto book. It is fabulous, by the way. When you begin the book, you can choose size and type and get pricing information. If you click on the layout/page view in the thumbnails above the book pages, you can see exactly how may pages you are using as you work. When you are finished, you are given the exact price with shipping information. Put in your credit card info and you're done. In the last week, I completed 6 books, all different sizes. These were the first I'd ever done and while I deleted the start a few times, it was pretty easy once I discovered the layout/page view. Hope this helps

Maybe you are looking for

  • My iphone(16g)Lost,how can I get it back?

    Hello All,My iphone lost,how can I get it back?Now the person who get my iphone has powered off iphone.I can't get call my iphone.

  • Purpose of selection view in report categories

    Hi Friends, Can anyone tell me the Purpose of selection view in report categories. Why we need to specify the selection view in report categories and what its impact in reports. Why do we need to create a custom selection views? Thanks in Advance. Re

  • Datecombo won't work under JRE1.5.0_06

    Hi, I am working on converting Java code from JRE 1.4.2 to 1.5.0_06. Our application works fine under JRE1.4.2, but not JRE1.5.0_06. I am having a problem to load an applet with DateComboBox widget. It is working under eclipse with JRE1.5.0_05. Once

  • How do I reply all to mail on iPad 1

    How do I reply all to mail on iPad 1.

  • Help need to get a mini cd out of my cd drive.

    The mini CD went in ok but is now lost inside the machine cos it isnt registering in Finder.  Please help! PS - Why dont macs have eject buttons and trays like normal machines?