EventQueue Order (focusLost and actionPerformed)

I have a JTextField and a JButton on the screen. I have set up a FocusListener for this JTextField and an ActionListener for the JButton.
If I enter text into the JTextField and then click the JButton with the mouse what order should I expect to see the events?
In most cases I get the focusLost event for the JTextfield and then the actionPerformed for the JButton.
However, I do sometimes get the actionPerformed first and then the focusLost. This seems to happen when running the Java client as a remote X11 client across a slow network connection. If the network is suffiiciently fast (whatever that is) then the events seem to come through as I'd expect.
When I get the actionPerformed event first then the button's hasfocus method returns FALSE. This makes sense since the textfield hasn't lost the focus yet.
Also if I run the client from my desktop machine without the remote X11 it works as I expect - focusLost on the textfield then actionPerformed on the button.
How can I be confident of the order of the events?
How can I tell and what do I do if the events come in out of order?

probably you solved it already, but for others:
public class DelayedButton extends JButton {
  private boolean actionPerformedDelayed = true;  // true = delay fireActionPerformed (default)
  public boolean isActionPerformedDelayed() {
    return actionPerformedDelayed;
  public void setActionPerformedDelayed(boolean delayActionPerformed) {
    this.actionPerformedDelayed = delayActionPerformed;
   * overwritten to make sure that actionPerformed is invoked
   * *after* focusLost has been processed by the opposite component!
  @Override
  protected void fireActionPerformed(final ActionEvent event) {
    if (isActionPerformedDelayed()) {
      EventQueue.invokeLater(new Runnable() {
        public void run() {
          DelayedButton.super.fireActionPerformed(event);
    else  {
      super.fireActionPerformed(event);
}Replace all JButtons in your app by DelayedButton and you're done.
Regards,
Harald

Similar Messages

  • Order of focusLost and actionPerformed events in Swing on Red Hat

    Hi!
    I have quite complicated bug, which must be fixed as soon as possible. Currently I am drinking my fifth coffee and I cannot find anything about this bug on the net.
    The bug looks like that:
    I have pane with several JTextField on it and a Save Button.
    Each JTextField has FocusListener with focusLost method. On focusLost event the entered text is validated and moved to the model object.
    After pressing the Save Button model object is saved to DB. This work perfect on Windows but not on Red Hat ( I have not yet check on Solaris).
    I enter the text in text field and press the save button with mouse. Then I receive information that the actionPerformed is called and save model object without entered text. After saving the focusLost is invoked and move the entered text to the previous saved object.
    I have look into several books but I haven't find any information about order of events. Maybe if I took some more time, but project dead line is soon.
    This is not my application, I only maintain it. I cannot read the JTextField on actionPerformed due to validation of data.
    Have someone any experience with such problem?
    I will be very appreciated for any help.

    I haven't receive any reply yet, but maybe my workaround will help someone else.
    I have figured out, that if I implement actionPerformed as InvokeLater it will cause proper order of focusLost and actionPerformed.
    So it looks like:
    actionPerformed() {
      SwingInvoke.invokeLater(new Runnable() {
        createSaveThread()
        startSaveTread()
    }Have a nice day :)

  • Report for Planned vs Purchase Order(Qty and rate)

    Hi
    I have the following issue. My client is raising Purchasing requisition and Purchase Orders in Me51N and ME21n respectively. The Project Structure is used only to plan the quantities and rates whereas no PR is released from it. But the components are attached. Now if i make use of the code CN52N, i am getting the planned quantity and unit rate for the planned value whereas no Purchase requisition number or purchase order number is updated in it.
    My requirement is that both planned quantity, rate along with Purchase order quantity and rate should be available in a report.
    1. Is there any setting that we can make so that the details are updated in cn52N (or)
    2. is there any other report with those details (or)
    3. Should that be achived only through ABAP.
    Please suggest.
    Raghav

    There are a few reports that you can use to display STO requisitions and orders, by supplying plant, material, or MD04 like was mentioned.
    The only thing that you don't have in a report is the link to the production order. In SAP in a MTS situation there's no fixed link (pegging) between the requirement (STO) and the supply (prod Ord).
    You can view the pegging dynamically, for example in MD04.
    Edited by: Mario Adler on Oct 27, 2011 12:13 PM

  • Open Work Order report and shortage report

    Hello,
    First of all, I am very new to SAP and sap forum. I do need to learn SAP very fast. I work as Buyer and Planner. I would like to know how do you run open work order report and also how do run shortage report.
    I appreciate different feedback.
    Thanks
    Raj

    Hi,
    Use tcodes CO24. First you need to activate that report PPCOXPR1 in SE38 enter report name and execute
    In COOIS select list components you can be requirement qty and withdrawn qty , here you can find out open work orders also
    Thanks
    Diwakar

  • Do you know the link between the sales order item and functional location ?

    How know the functional location if I know de sales order number and item ?
    Wich table or bapi ?
    Tks.

    Hi,
    I think there's all details in my question.
    You answer is right only if I need to know the functional location at AUFNR level.
    Is not my case, I need this information at sales order level.
    Regards,
    Roberto.

  • What is diff b/w order series and time seriesu2026

    what is diff b/w order series and time seriesu2026

    Hi S R,
    Order series is the concept used in SNP whereas time series is concept used in DP.
    ie In SNP, orders are stored in livecache as Order series whereas in DP, the historical data is stored with respect to time, ie time series in DP.
    Regards
    Senthil mareeswaran.

  • Order qty and confirmed qty mismatch

    Dear friends,
    My requirement is System should not allow to go further if the sale order qty and confirmed qty(after avaialbility check) mismatch is there.Pls suggest.
    Now currently system will check the availability qty and will show the information of confirmed qty in the another screen.and if we say continue the process, we can go ahead and save the document.but the document will be in open state.
    So pls suggest the way i can go ahead for this requirement.
    Regards
    Mahendar.

    hi,
    If u want to allow user to create SO as much as available qty..? means  system sud create SO for order qty is equal to availble qty ...? if yes
    then go the availbality check  and find out availability check and checking rule..
    and again go to OVZ9 remove the check box check with out RLT from rep.lead time tab
    Resul is: If u enter in SO a10 qty ,and if you have only 5 qty in hand or in plant ,then system after checking the items it will change the order qty in SO(i e 5) automatically,
    Caprin

  • Open Orders (Confirmed and Un-Confirmed)

    Hello BW Gurus,
    I am looking for Standard BCT that can give me True Open Order "quantities" and "Amounts". The extractor 2LIS_11_V_SCL seems to give open order qty for "Confirmed" Schedules only. I am looking to get the "Net Open Orders" based on "Planned Goods Issue Date".
    Any ideas on how to achieve this?
    Thanks in advance.
    Srini

    Hi Lily,
    But these extractors comprises of all orders thus, it means open orders,confirmed and not confirmed, delivered and not delivered, and orders that are already invoiced.
    In my case, we need to have an open orders report meaning confirmed and not confirmed and where invoiced orders, delivered, and etc should not be included at all.
    Any idea?
    Thanks
    Sheila

  • Diffrence in incomming order qty and billing qty in cube 0sd_c03 & 0sd_c01

    Dear All.
    i have uploaded 2 cubes 0SD_C01 & 0SD_C01 from our R/3 data, SAP recommed for 0SD_C03 for sales analysis and their best practice is also based on 0SD_C03  but it is very strange the values of both the cubes are not the same when i run the report but the values of 0SD_C01 is 100% same as R/3 values i.e. mcsi reports show the same incomming and billing qty as i can see in report for 0SD_C01 but strang to see in 0SD_C03 there is diffrence in these values.
    can any one explain why did this happen as SAP recommed to use lbwe data sources and their best practice also base on 0SD_C03 and the other one i.e. 0SD_C01 is based on old LIS structures.
    during exploration i come to know that in some material orders incomming and billing quantaties are same but diffrence in most of them.
    any help will be highly appreciated.
    thanks & best regards,
    Zeeshan

    Hi,
    There are somany Routines for Keyfigures in both Cubes, I hope you may using 0QUANT_B key figure for Qty, the reason is there may be some difernece in Routines in both cubes, so you need to check it tehn you check in teh reports, whether is there any restrictions, you need to iopen the each node and check i nthe both reports.
    I also faced teh same problem with MCSI and BW reports, MCSI, we can customizi it an dut is just InfoStructure and having routines internally. So you need to take one material, plant and date where the diffrenece is coming then track it.
    Check OSS NOTES:
    Note 166996 - BW InfoCube 0SD_C03: incorrect incoming order qty
    Note 1156259 - Update rules incorrect for InfoCube 0SD_C03
    Thanks
    Reddy
    Edited by: Surendra Reddy on Aug 10, 2009 7:19 AM

  • Outline Agreements - min order qty and regular vendor flag

    As a part of E Source Integration with ECC we are planning to leverageusing Outline Agreement(Contract Type MK) to store
    Price and other Business Terms for Material / Vendor combinations. Currently we are
    using Purchase Information Record with minimum order quantity and
    regular vendor flag functionalities, and these are maintained manually.
    We intend to use Minimum Order qty and Regular Vendor Flag
    indicator in Outline Agreement as well, however noticed that these fields are
    not available in the screens. Does anyone know if these fields can be enabled in an outline agreement?

    Guys
    thanks for reply..
    But I thnik my question was not fully clear as the aswers didn't make sense to me...
    As a logistics consultant .I know that I can maintain Min Order qty for a material + vendor at PIR level..
    My question ..if I buy 10 items in a PO from a sinle vendor..is there any option to restrict Min qrder qty for these combination of materials..
    or in other words vendor says he dont care about number of items ,but the lot lot should be min..10 cartons only..
    appropriate points will be rewarded.
    thanks in advance.

  • Purchase order Revision and Releases

    Hello All
    Can any one tell me the keyfig for Purchase order Revisions and Releases.I am trying to built a report that has PO Revision count and PO Releases count.
    Any help would be appreciated
    Thanks

    Hi,
    PO release is a approval procedure. If a PO fulfills certain conditions (e.g. the total order value exceeds $10,000), it has to be approved (by the cost center manager, for instance) before it can be processed further. This process of approving is knows as release procedure.
    PO revision refers to changes made to PO. If an existing PO is changed, the system can print an amended PO displaying the changes. The first change is printed as 'amendment no. 1", the second as 'amendment no. 2" and so on.
    Hope this helps.

  • Order qty and total confirmed qty in PI sheets

    Dear Experts,
    Kindly suggest the possibility of appearing total order qty and already confirmed qty in the PI sheet, system useually provides the same while performing confirmation through co11n or cor6.
    Thanks in advance for your help..
    Regards,
    Nitish

    Hi Srini,
    The following details are available in the table AFVV,
    Standard value, operation qty & Base qty.
    With this values create a formula Standard value * operation qty/ Base qty , this will equal to the planned hours for that particular activity type. Similarlt planned hours for other activities can be calculated.
    The actual/confirmed hours are available in the table AFRU.
    Regards,
    Senthilkumar

  • Regarding production order closing and demand closing

    Hi Gurus,
    I am new to pp module..
    I have the requirement on production order closing and demand order closing.
    The requirement needs plant,reuirement plan no ,basic finish date and percentage in selection screen.
    In the output display plant,requirement plan no,PIR No,order,order finish dat ,***.order qty,***.delivered qty,qty difference,percentage%,order status as in alv grid display.
    And in the output it has 2 buttons named technically complete and demend close .whener user click on first button system should take all the orders which r selected to the program with the same reuirement plan as for the selected order and then technically close all the orders with the same reuirement plan number.
    when user clicks on demand close button,system should take the respetcive requirement plan number,order finish date and material and it has to take the pir no which match the above and deactivate the pir and save.
    I need the help about this.
    Thankx in advance.

    Dear Chandu,
    First settle the production order using the T Code CO88,and then close the production order.
    Prerequisites
    Prerequisites for setting the CLSD status are:
    The order must have the status Released (REL) or Technically completed (TECO)
    The order balance must be 0
    There can be no open purchase requisitions, purchase orders or commitments
    There can be no future change records from confirmation processes
    Regards
    Mangalraj.S

  • Purchase orders : Open and Completed,Open Only,and Completed Only

    Hi Friends,
    I have got a new requirement in Existing report I have to add few fields Like :
    Slectio screen will be :
    Purchase orders :
    Open and Completed     only
    Open Only
    Completed Only
    When I select open and Completed only, it display only those purchase orders.
    if i select Open only, it should display only open purchase orders, Like wise for Completed .
    Could you please from which table i can find out the purchase is open and completed, or open only, completed only?
    Could provide me the fileds for
    Open and Completed     only ?
    Open Only ?
    Completed Only?
    Regards,
    Xavier.P

    Hi Xavier ,
    Purchase orders :
    Open and Completed only -- All PO in EKKO Table
    Open Only -- Table EKPO for which Final Invoice Indicator(EREKZ) is not set
    Completed Only -- Table EKPO for which Final Invoice Indicator(EREKZ) is set
    Regards
    Ramesh Ch

  • Reg Open sales order item and the quantity

    Hi experts:
    I am getting open sales order item based on inner join of tables(vbak, vbap, vbep). Not using vbbe table in inner join as it doesnt carry all pending open records.
    can any one say how open sales order items  and their quantity can be retrieved?
    I searched forum and saw usage of vbuk and vbup tables, but it does not accomplish our scenario.
    Thanks in advance,
    Sashti.

    Hi,
    1) fetch the header information from VBAK table.
    2) Based on VBAK table fetch all the line items from VBAP table.
    3) Now fetch from VBFA table.
    *-Fetch from VBFA to get the delivered qty
      SELECT vbelv               " Preceding sales and distribution document
             posnv               " Preceding item of an SD document
             rfmng               " Referenced quantity in base UOM
        FROM vbfa
        INTO TABLE lt_vbfa
         WHERE vbelv   = gv_vbeln
           and vbtyp_n = 'J'.
    4) By comparing VBFA-POSNR just filter the records from the VBAP internal table. Remained lines are open lines of the sales order.
    Regards,
    ~Satya

Maybe you are looking for

  • Generating CSV file with column names and data from the MySQL with JAVA

    Hi all, Give small example on ... How can I add column names and data to a CSV from from MySQL. like example sequence_no, time_date, col_name, col_name 123, 27-apr-2004, data, data 234, 27-apr-2004, data, data Pls give small exeample on this. Thanks

  • Logical diagram's relation lines invisible

    In my logical diagram and its subviews, a few of the lines (maybe 10%) representing relations aren't appearing between the entities.  The relations exist and appear to be defined just as the ones that do appear.  In "Show/Hide Relationships", they're

  • Lightbox in flash

    hey guys, i found a lightbox that apparently works with flash.. so i did everything they say to do on the html part... and they say to put this on your button: test.onRelease = function(){ getURL("javascript: myLightWindow.activateWindow({href: 'http

  • UI defaults on SQL Workshop

    What type of table is added to 'Tables with UI Defaults' list on SQL Workshop? After installing a new htmldb, EMP table have already been listed on it. However, behavior when tables are created using Data Workshop is different, some goes into the lis

  • Customer number not picked up

    Hi Friends, i have created a 3rd party sales order, as you are all aware the purchase requisistion gets automatically created in the back ground, now if i go and the PR to my suprise there is no customer which should be present in delivery address ta