Having troble focusing when updating swing form type application

I'm writing a piece of code where it is necessary to allow the end-user to unmask a password. I want the focus to return to the text field/password field however because it is necessary to call repaint() using the ActionListner calling requestFocusInWindow has very little effect. This is because repaint que's and is run by run by the thread that was running the ActionListner, (I hope I'm making sense). I don't do GUI often for obvious reasons. Please look at the Box bellow and tell me if you have a solution.
import javax.swing.*;
import javax.swing.text.Document;
import javax.swing.text.PlainDocument;
class Blah extends Box {
  protected final Document doc=new PlainDocument();
  JTextField jtf=new JTextField(doc,null,10);
  JPasswordField jpf=new JPasswordField(doc,null,10);
  JCheckBox jcb = new JCeckBox("switch");
  Blah(){
    super(BoxLayout.X_AXIS);
    jcb.addActionListner(new LayoutAction(this));
    this.invalidate(); //Makesure that doLayout is called (not verbosely necessary)
  @Overrides
  public void doLayout(){
    this.removeAll();
    /*This is the main function of the code */
    if(jcb.isSelected())this.add(jtf);
    else this.add(jpf);
    this.add(jcb);
    super.doLayout();
} class LayoutAction implements ActionListner {
  JComponent owner;
  LayoutAction(JComponent owner){
    this.owner=owner;
  public void actionPerformed(ActionEvent e){
    this.owner.revalidate();
    this.owner.repaint();
}

Hey thanks... That helped out with another situation similar to this I was having trouble with... Turns out it's the revalidate() that makes requestFocus() usless thus I changed the code to have teh request focus in the overriden doLayout().... I'm sure this doesn't matter to you much more than you were being helpful.
So thanks!!! :)

Similar Messages

  • Conditional Redirct when Updating a Form

    In my form's update button I'm running several validations. If one of the validations doesn't pass I need to completely bypass the default update and call a procedure. This procedure does part of the update and then redirects to a different form. I can't use the standard redirect on successful submission because I don't want it to redirect each time.
    I have tested and when the condition is met it is calling the procedure, just not doing the redirect.
    Any suggestions?
    Here is the code in my update button:
    declare & set variables
    if v_user1 is not null then
    v_sup1 := pkg_proj_manage.fcn_get_sup(v_user1);
    end if;
    if v_user2 is not null then
    v_sup2 := pkg_proj_manage.fcn_get_sup(v_user2);
    end if;
    if v_user3 is not null then
    v_sup3 := pkg_proj_manage.fcn_get_sup(v_user3);
    end if;
    if v_user4 is not null then
    v_sup4 := pkg_proj_manage.fcn_get_sup(v_user4);
    end if;
    if v_user5 is not null then
    v_sup5 := pkg_proj_manage.fcn_get_sup(v_user5);
    end if;
    v_ok := pkg_proj_manage.fcn_verify_end_dates(v_projnum, to_char(v_estenddate, 'MM/DD/YYYY'), to_char(v_enddate, 'MM/DD/YYYY'));
    if pkg_proj_manage.fcn_val_type(v_type, v_stage) <> 'Y' then
    v_message := pkg_proj_manage.fcn_val_type(v_type, v_stage);
    v_ok := 'N';
    end if;
    if pkg_proj_manage.fcn_check_status(v_status, v_user1, v_eststdate, v_estenddate, v_stdate, v_enddate) <> 'Y' then
    v_message := pkg_proj_manage.fcn_check_status(v_status, v_user1, v_eststdate, v_estenddate, v_stdate, v_enddate);
    v_ok := 'N';
    end if;
    v_statusdate2 := pkg_proj_manage.fcn_status_date(v_status, v_statusdate);
    if v_statusdate2 is not null then
    p_session.set_value(p_block_name => 'DEFAULT', p_attribute_name => 'A_STATUS_DATE', p_value => v_statusdate2);
    end if;
    if pkg_proj_manage.fcn_val_enddate(v_enddate, v_status) <> 'Y' then
    v_message := pkg_proj_manage.fcn_val_enddate(v_enddate, v_status);
    v_ok := 'N';
    end if;
    if pkg_proj_manage.fcn_val_dates(v_enddate, v_stdate) = 'N' then
    v_ok := 'N';
    v_message := 'The actual end date must be equal to or after the actual start date';
    end if;
    if pkg_proj_manage.fcn_val_dates(v_estenddate, v_eststdate) = 'N' then
    v_ok := 'N';
    v_message := 'The estimated end date must be equal to or after the estimated start date';
    end if;
    if pkg_proj_manage.fcn_rescind_status(v_status, v_ok, v_sup, v_sup1, v_sup2, v_sup3, v_sup4, v_sup5) <> 'Y' then
    v_message := pkg_proj_manage.fcn_rescind_status(v_status, v_ok, v_sup, v_sup1, v_sup2, v_sup3, v_sup4, v_sup5);
    v_ok := 'N';
    end if;
    if v_ok = 'R' then
    pkg_proj_manage.prc_redirect_dateform(v_projnum, to_char(v_estenddate, 'MM/DD/YYYY'), to_char(v_enddate, 'MM/DD/YYYY'), v_type,
    v_stage, v_user1, v_user2, v_user3, v_user4, v_user5, v_sup, v_status, v_desc, v_group, v_request, v_dept, v_dept2, v_dept3,
    v_liason, v_liason2, v_liason, v_notes, v_requestor, to_char(v_stdate, 'MM/DD/YYYY'), to_char(v_eststdate, 'MM/DD/YYYY'), to_char(v_statusdate, 'MM/DD/YYYY'));
    return;
    elsif v_ok = 'Y' then
    doUpdate;--- This is the default handler
    p_session.set_value(p_block_name => 'DEFAULT', p_attribute_name => 'A_V_MESSAGE', p_value =>' ');
    end if;
    if v_message is not null then
    p_session.set_value(p_block_name => 'DEFAULT', p_attribute_name => 'A_V_MESSAGE', p_value => v_message);
    p_session.set_value(p_block_name => 'DEFAULT', p_attribute_name => '_STATUS',
    p_value => 'There is an error with your entry');
    return;
    end if;
    end;

    I have a similar problem, I'v been searching for this error and I found that is a BUG (#380655), there is a patch to solve this, but i did4n find it at internet, may be if you have the CD's patches can solve this BUG.
    See you !

  • FRM-40501 When updating a form

    Hello everyone,
    I need some help with a master-detail form I am working on.
    The master is based on a table, let's call it t1 and there are no problems with it.
    The detail is based on a view (v1) , getting data from two tables ( let's say t2 and t3). T2 is just an intersection table of a many to many relationship between t1 and t3.
    I wrote a trigger (instead of) on v1, and everything works in SQL+.
    Whenever I try to update a value from t3 in my detail data block, I get FRM-40501.
    I did a search on this board, applied all the suggested changes ( all my blocs have primary keys, the form has serializable isolation mode , the key property set to "updateable") but the error keeps coming back.
    Inserting new rows works, delete does not.
    Any other suggestions ?
    TIA
    BN
    PS Versions are 8.1.7.0 Enterprise edition and Forms (32 bit) 6.0.8.8.0

    I have a similar problem, I'v been searching for this error and I found that is a BUG (#380655), there is a patch to solve this, but i did4n find it at internet, may be if you have the CD's patches can solve this BUG.
    See you !

  • ITunes v11 steals focus when updating applications

    iTunes continually takes focus away from other programs while it is downloading updates to existing applications.
    I search through the preferences and cannot find a place to tell it to stop.
    Please advise on how to stop it!!!
    iTunes version 11.0.0.163
    WIndows 7 x64bit

    I have found a fix that works for me using  iTunes v. 11.0.2.6 and Windows 8
    The fix however eliminates ANY program from stealing focus in windows.  Which I prefer anyway.  This means that you will have to pay attention to your desktop bar or start menu for flashing.  This will let you know the program is asking for your attention.
    Open Regedit
    Browse to HKCU\Control Panel\Desktop\
    Change “ForegroundLockTimeout” to “30d40”  (make sure this is in HEX not Decimal)
    Restart your Computer.
    For those of you worried about messing with your registry, it is a serious thing to do and it should NOT be taken lightly, Here’s the Page from Microsoft telling you what the key is so you know this is legit fix.  I always recommend backing up your registry and creating a save point BEFORE making any changes.
    http://technet.microsoft.com/en-us/library/cc957208.aspx

  • Adobe SDK steals focus when user is using another application

    Hi,
    I’m relatively new to using the Adobe Acrobat SDK, and I’ve encountered a problem that I can’t seem to solve.  It is probably related to the various Focus-loosing problems in this forum, although I haven't seen an exact duplicate issue, so I'm submitting this one
    We are using Adobe Acrobat Pro Ver 9 and the Adobe Acrobat SDK 9.1.
    We have an application that produces quite a few documents, mostly AutoCAD DWG files and Excel XLS files.  We just wrote a module to take all the documents we’ve created and convert them into PDFs and then into a single PDF Binder, using the Adobe SDK.  Our application is a Microsoft Visual C++ application using Visual Studio 2005.
    We basically took the SDK sample code from the ReadCADFileVC sample, put it into a loop, and tweaked the dialog to make it look the way we wanted.
    In general, this has actually worked great for us.  However, we have encountered a serious problem.  If the user selects a large number of DWG or XLS files to convert, the conversion of course takes some time.  So while it is running, the Users will usually do something else, like write an email, or write a document, or other things where they type on the keyboard.  The problem is, the Acrobat SDK code periodically temporarily steals the focus from the other application the User is working in, and the typed in characters appear to get redirected to the spawned instance of AutoCAD or Excel that the Acrobat SDK created, and this causes the whole process of conversion to simply freeze!!  It also annoys the user when their typed in characters simply do not appear in their email or document.  It appears that the typed in characters get sent to AutoCAD (or Excel), and those applications stop and wait for more input from the user.  In tests with just Acrobat Pro, Excel usually puts up a "Save As.." dialog, whereas AutoCAD interprets the characters as commands for its Command Line, so it just waits for more input from the user.
    As noted above, we’ve also verified that this problem occurs when you simply run Acrobat Pro Ver 9 and use it to convert a DWG file.  If you have an email or Word doc open, then start the conversion, then go back to the email or Word Doc and start typing, eventually Acrobat Pro steals the focus and the typed in input gets redirected to AutoCAD, which causes the conversion process to fail.
    We’ve tried a lot of different things in code, like calling CAcroApp->Hide(), or making it invisible, etc., but nothing has helped!!
    We need help fixing this, since we can’t ship the product with it acting like this!!!
    I have code anyone can look at, but it's rather long to add to this message, and the forum does not appear to allow attacment of files, so if anyone answering this needs the code, I can email it.
    Thanks!

    Thanks for the quick reply!
    However, since Acrobat Pro has this problem, and the sample code ReadCADFileVC has this problem,  it does not seem correct to say this is "as designed".  It's a major problem!  Just using Acrobat Pro, the process gets aborted when the user is typing in some other program!  This cannot be deemed acceptable by Adobe?!
    This problem makes using Acrobat Pro, ReadCADFileVC, and the code in our application based on ReadCADFileVC very problematic for our users.  The must be some way to get Windows to prevent this from happening.  I've seen too many other posts on this forum and others about this and realted problems to think that Adobe is going to tell us this is "as designed".

  • I am having runtime errors when trying to open an application

    when I download something and try to open it, a box pops up saying runtime error, then makes me close it, so therefore I cannot print it, help please

    What is your operating system?
    What is your Reader version?

  • Update record form wizard

    I am having problems with inserting update record forms and
    Custom From from the wizards into php files i am using Dreamweaver
    cs3 and Developer Toolbox.
    An Insert form works OK.
    The Update Form inserts into the page and can be accessed
    from the server, bit on attempting to update database I get the
    following message:
    quote:
    Developer Details:
    tNG_update.prepareSQL:
    No Primary Key Column was set. (UPD_NO_PK_SET)
    quote:
    tNG Execution Trace - VIEW
    * tNG_update.executeTransaction
    o STARTER.Trigger_Default_Starter
    o tNG_update.doTransaction
    + BEFORE.Trigger_Default_saveData
    # tNG_update.saveData
    + BEFORE.Trigger_Default_FormValidation
    + tNG_update.prepareSQL*
    o tNG_update.getRecordset
    o tNG_update.getFakeRsArr
    o tNG_update.getLocalRecordset
    o tNG_update.getFakeRecordset
    /Q]
    When using the Custom form wizard (inset and update) and
    {else} statement is inserted into the code and only the 'insert'
    button appears when I require 'insert', 'update' and 'delete'.
    Has anyone else experienced this - is there something I am
    not doing?

    Hi Glenn, I kept having the same problem this morning. What I
    finally figured out is that I wasn't using the session variables
    properly. For example. My user_ID field maps to the session
    variable name kt_login_id
    my email field maps to kt_login_user (I use my email as user
    name) and password is kt_password. I finally printed out the
    Session information from login settings in the control panel so I
    was sure to fill out the data in the update wizard correctly.
    Open up the Update Transaction panel and under the Fields
    Tab, you can see how your table fields are mapped to the session
    fields. Hope it helps.l

  • Indesign 5.5 crash issues when updating links

    I am having crash issues when updating links and I don’t know how to trouble shoot the issues.
    I have adobe creative suite 5.5 and I am using a third party plug in called wordsflow to allow updating of MS word documents without losing formatting in Indesign.
    I have been in contact with the plug creator and they seem to think that the way the indesign importer is handling images is causing the problem.
    I am not a particularly experienced Indesign user. How do I go about working out what the issue is?

    At first it does appear that the plug in is the problem, however i suspect that the builders of the plugin are correct, in that it is the way in design in handling images in links.
    the problem is worse when any image in anchored any where with in the document.
    when the updating links screen pops up, the point where it freezes and then indesign crashes is infact on a linked image file consistantly.
    broswing other indesign link issues it appears i am not the only person with image link problems.
    My question is aside form turning off the plug in, what else can i do to search for the potential issue?

  • 2 Effects I am having troble with doing

    I am having troble making the audio wave forms just like in this video.
    http://www.youtube.com/watch?v=JE0-6Djm0lU
    I must not be doing something right.
    If someone can please help me with that.
    I also need to know how to do this effect.
    http://www.youtube.com/watch?v=OrtVxd1vhAQ&feature=related
    Thanks!
    Dan

    I must not be doing something right.
    If someone can please help me with that.
    What do you expect us to do?  Watch the tutorial for you, or something?  Use the Vulcan Mind Meld to identify where you went wrong? 
    C'mon, dude, get a grip, willya?  Just watch the tutorial a few times and figure it out.
    I also need to know how to do this effect.
    Uh-huh.  First, a question: how long have you been using After Effects?  How do you count your time actually using the application?  Years?  Months?  Weeks?  Days?  Hours?  It'll tell us the direction in which we should point you for maximum benefit.

  • My Iphone 5 is having trouble focusing everytime I am trying to take a picture. Does anyone know what is wrong with it?

    Iphone 5 is having trouble focusing when taking pictures.

    Try This...
    Close All Open Apps... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...

  • Incorrect Infopath content type update in form library after modifying Infopath form and publish it

    I have an admin approved InfoPath form. I added new fields to that form and mapped those new fields with site columns. After uploading updated published form through CA, I noticed InfoPath Site content type for that form got updated (with newly added fields)
    under Microsoft_Infopath group. This content type is also added in form library but somehow the new fields are updated incorrectly for this content type existing in form library (it doesn't show new fields, and shows one new field which is incorrectly
    mapped with other column this is happening only in library). 
    Things I tried:
    - Activate/Deactivate that content type feature
    - Deactivated feature, removed form from CA, re uploaded and activated feature
    - Removed those new fields and published and uploaded InfoPath form and then added those new fields and published and uploaded again.
    -Deleted those fields from InfoPath and readded new fields and published and uploaded form but still the problem persists.
    Any help will be appreciated.
    Dhaval Raval

    Hi Thanks for the response,
    But Update all content types inheriting from this type is already checked.
    That form library has multiple content types associated with it , different infopath forms get submitted there. What I noticed is that when I change the form and publish it, its corresponding site content type gets updated but the same content type used
    in form library doesn't get updated properly. I went to form library and checked that erroneous content type, there were some columns missing and one column was mapped incorrectly. When I clicked on "Parent" content type, it was showing all the new Infopath
    fields(updated content type). So I figured that Infopath site content type was getting updated correctly but it was not able to propagate those updates (in a correct way) to the form library. I also tried to edit that content type and tried adding existing
    site columns which were missing but surprisingly it was not showing those site columns either, which were mapped from Infopath publishing.
    The cause for this behavior is : changes/updates to the Infopath content type are not getting propagated to the form library and this is happening for only one infopath content type but other Infopath content types are getting updated.
    I had to delete all the forms using that erroneous content type and then had to delete that content type from the library and then re-added that Infopath content type to the library and this time it was having correct content type (updated columns).
    This is not a perfect solution for the production environment, sounds like it is a bug.
    Dhaval Raval

  • Error Message when trying to update a form

    Hello,
    I receive the following error message when I try to update a form:
    Error: The preference path does not exist: ORACLE.WEBVIEW.PARAMETERS.1129327645 (WWC-51000)
    The preference path does not exist: ORACLE.WEBVIEW.PARAMETERS.1129327645 (WWC-51000)
    Insufficient privileges (WWV-12600)
    When I click on the Update button on my form, I call a dynamic page which calls a procedure to update the database and display a confirmation message to the user.
    The parameter I am having a problem with is the v_ins_1.
    This links does not work: http://XXX:####/servlet/page?v_prt_stck_1=CLIENT+PAPER&v_prt_stck_2=&v_prt_stck_3=&v_prt_stck_4=&v_env_stck=&v_ins_1=SS-002+Dollar+Cost+Averaging+%28PMID+%3D+40215%29&v_ins_2=&v_in s_3=&v_ins_4=&v_ins_5=&v_ins_6=&v_del_opt=&submit=Update&p_plan_id=01234&p_cust_id=INV&p_lot_type=MAIN&_pageid=59&_dad=portal30&_schema=PORTAL30&_mode=3&_type=site&_fsiteid=34&_fid =2543&_fnavbarid=1&_fnavbarsiteid=34&_fedit%3D0%26_fmode=2&_fdisplaymode=1&_fcalledfrom=1&_fdisplayurl=
    This link works: http://XXX:####/servlet/page?v_prt_stck_1=CLIENT+PAPER&v_prt_stck_2=&v_prt_stck_3=&v_prt_stck_4=&v_env_stck=&v_ins_1=*Custom+Inventory&v_ins_2=&v_ins_3=&v_ins_4=&v_ins_5=&v_ins_6=& v_del_opt=&submit=Update&p_plan_id=01234&p_cust_id=INV&p_lot_type=MAIN&_pageid=59&_dad=portal30&_schema=PORTAL30&_mode=3&_type=site&_fsiteid=34&_fid=2543&_fnavbarid=1&_fnavbarsitei d=34&_fedit%3D0%26_fmode=2&_fdisplaymode=1&_fcalledfrom=1&_fdisplayurl=
    Any suggestions?

    Also got a message "Acrobat failed to set up a workflow folder in the specified shared folder or hosted service"..?

  • Since the last software update for mountain lion I am having a problem when moving screenshots to trash. Now a Finder box appears saying finder wants to make changes and I have to enter my password for every action.

    Since the last software update for mountain lion, I am having a problem when trying to remove any screenshots to the trash. A box appears saying "Finder wants to make changes. Type your password to allow this"
    I have checked Finder Preferences and cannot find any box that I can 'UNTICK' to resolve this. I sometimes take a lot of screenshots when I am researching something and now find I have to enter my password for every screenshot to be removed to trash.
    Anyone got a solution please, Thanks

    Have you looked at the previous discussions listed on the right side of this page under the heading "More Like This"?

  • I've just updated my iPad 3 to IOS 7 and when i try to type any thing be it a password or e-mail there is a long lag any idea how to sort this out ?

    I've just updated my iPad 3 to IOS 7 and when i try to type any thing be it a password or e-mail there is a long lag any idea how to sort this out ?

    Upgrade to Snow Leopard - it's compatible with the latest version of iTunes, and still supports PowerPC applications.
    $19.99 - http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
    Snow Leopard is required if you wanted to upgrade to Lion, anyway, which you may want to in the future if the latest version of iTunes no longer supports Snow Leopard.

  • IW41: automatic update of activity type when changing the work center?

    Hello colleagues,
    when doing a time confirmation with IW41, we have following problem:
    In the PM order the operations are assigned to a neutral executing work center, as it not known which individual technician is completing the operation later on.
    Now when the individual technician is entering the time confirmation with IW41, system is proposing the work center indicated in the operation from the PM order, then technician is overwriting the work center proposal with his own individual work center ID (and pressing Enter), but the activity type is not getting updated automatically. So the technician must jump to field "activity type" and choose the correct activity type.
    Is there any solution (hopefully with user exits!) to have the field "activity type" automatically updated with the one indicated in the work center, which was entered manually?
    Thanks for your ideas!
    Regards,
    Patrick

    Hi Maheswaran,
    yes, as usual all PM work centers have only 1 activity type assigned in the costing tab.
    We also checked the settings of the activity type (KL03), but we just found one difference: the price indicator was set on 3 "Determined manually" - we've changed to 1 "Plan price, automatically based on activity" (..same setting as for the act. type of the work center with working update of act.type).
    We tested already all possible constellations and scenarios, but we have not found any good reason for the behaviour.
    Thanks for your efforts so far!
    Patrick

Maybe you are looking for

  • Firewire device looses connection when external screen is inserted into the thunderbolt port? HELP

    HI I am a recording studio engineer. Ive got a Firewire AD/DA Converter (Focusrite Saffire Pro 56) running from my Firewire port of my MacBook Pro, which is running OSX Mavericks. I've also got an external Screen I want to use as an extended display.

  • Disk Image Fails

    Hi everyone, I am currently trying to back up some discs that I have, and the first 2 did so with no problem. I am saving them to a 1tb external hd. However now every time I try to create a new disk image it starts and goes for around 10 minutes then

  • Quotes in SQL data

    Hello all, I have implemented a SBO solution with a customer and transeferred all legacy data. However all data in the item masterdata received quotes at the beginning and end of every itemname. For instance, if the DTWB excel template stated : screw

  • How can I turn off time stamp

    How can I turn off time stamp when packaging .air file

  • Information within the home hub

    Has anyone recently challenged the accuracy of the online monitor for Broad Band usage? I have been told I am going to breach the limit despite being on holiday. When I looked into the home hub the data usage over a connection time of nearly ten days