How to capture the event on changing focus from a JTextField?

Hi All,
I have got a problem...
I want to do something (say some sort of validations/calculations) when I change the focus by pressing tab from a JTextField. But I am not able to do that.
I tried with DocumentListener (jtf01.getDocument().addDocumentListener(this);). But in that case, it's calling the event everytime I ke-in something in the text field. But that's not what I want. I want to call that event only once, after the value is changed (user can paste a value, or even can key-in).
Is there any way for this? Is there any method (like onChange() in javascript) that can do this.
Please Help me...
Regards,
Ujjal

Hi Michael,
I am attaching my code. Actual code is very large containing 'n' number of components and ActionListeners. I am attaching only the relevant part.
//more codes
public class PaintSplitDisplay extends JApplet implements ActionListener
     JFrame jf01;
     JPanel jp01;
     JTextField jtf01, jtf02;
     //more codes
     public void start()
          //more codes
         jtf01 = new JTextField();
          jtf01.setPreferredSize(longField);
          jtf01.setFont(new Font("Courier new",0,12));
          jtf01.setInputVerifier(new InputVerifier(){public boolean verify(JComponent input)
               //more codes
               System.out.print("updating");
               jtf02.setText("updated value");
               System.out.print("updated");
               return true;
          //more codes
          jtf02 = new JTextField();
          jtf02.setPreferredSize(mediumField);
          jtf02.setEditable(false);
          jp01.add(jtf02, gbc);
          //more codes
          jf01.add(jp01);
          jf01.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          jf01.setVisible(true);
          //more codes
     public static void main(String args[])
          PaintSplitDisplay psp = new PaintSplitDisplay();
          psp.start();
     public void actionPerformed(ActionEvent ae)
          //more codes
}As you can see I want to update the second JTextField based on some calculations. That should happen when I change the focus from my frist JTextField. I have called jtf02.setText() method inside InputVerifier. But it's giving error...
Please suggest...
Ujjal

Similar Messages

  • How to capture the event in ALV grid display?

    Hi experts,
      How to capture the event in an ALV grid display which is editable. I have to capture the TAB key or ENTER key.
    regards,
    Arul Jothi.

    Hi Arul,
    Take a look at sample program BCALV_EDIT_03. (Find string "register ENTER" in the program to see how to register)
    Basically you have to Register edit events using method call REGISTER_EDIT_EVENT and then write a handler method for event DATA_CHANGED..
    If you are using a REUSE..GRID fm then first get the grid reference using function module GET_GLOBALS_FROM_SLVC_FULLSCR and then repeat the above procedure..
    Hope this helps..
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • How to catch the event for change dropdown value in alv

    it has a column output by dropdown in alv. the dropdown type cl_salv_wd_uie_dropdown_by_idx.
    now the problem is if change the dropdown value, i want to catch the event to change another column value.
    how can i do it?

    This part contains other ALV initialization code
    *... init ColumnSettings
      DATA:
            lr_column_settings TYPE REF TO if_salv_wd_column_settings.
      lr_column_settings ?= wd_this->r_table.
      DATA:
            lt_columns TYPE salv_wd_t_column_ref.
      lt_columns = lr_column_settings->get_columns( ).
      DATA:
            ls_column     TYPE salv_wd_s_column_ref,
            lr_col_header TYPE REF TO cl_salv_wd_column_header,
            l_tooltip     TYPE string.
      LOOP AT lt_columns INTO ls_column.
        CASE ls_column-id.
          WHEN 'PLANETYPE'.
            DATA:
                  lr_drdn_by_key TYPE REF TO cl_salv_wd_uie_dropdown_by_key.
            CREATE OBJECT lr_drdn_by_key
              EXPORTING
                selected_key_fieldname = ls_column-id.
            lr_drdn_by_key->set_key_visible( abap_true ).
            ls_column-r_column->set_cell_editor( lr_drdn_by_key ).
          WHEN OTHERS.
        ENDCASE.
    ENDLOOP.
      DATA:
            node_info TYPE REF TO if_wd_context_node_info,
            lt_valueset   TYPE STANDARD TABLE OF wdr_context_attr_value,
            l_value       TYPE wdr_context_attr_value.
      node_info = wd_context->get_node_info( ).
      node_info = node_info->get_child_node( 'FLIGHT_INFO' ).
    data : lt_sflight type STANDARD TABLE OF sflight,
           ls_sflight like LINE OF lt_sflight.
    SELECT * from sflight into TABLE lt_sflight.
    LOOP at lt_sflight into ls_sflight.
      l_value-value = ls_sflight-planetype.
      l_value-text  = ls_sflight-planetype.
      INSERT l_value into TABLE lt_valueset.
      ENDLOOP.
      node_info->set_attribute_value_set(
      name = 'PLANETYPE'
      value_set = lt_valueset ).

  • How to capture the event in driver JSplitPane

    Hi all, i have some problem with the JSplitPane.
    What i want to do is that:
    i need to capture the event throw when the user press the button in the driver of the JSplitPane, this is because i want to know wich side of the splitpane is complet visible.
    Thanks for your time!
    Luca

    I thought I would do up an example just for fun. As you drag the splitter bar the size of the two components and the splitter component is reported to the console along with the divider location. Interestinly, on my system (Windows XP, Java 1.41_02) when you move the bar downwards the divider location is consistantly two pixels past the height of the top component but when you drag the bar upwards the divider location and the height of the top component are the same.
    Does anyone have any ideas why that would be?
    Here is the test app:package splitPaneMonitor;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import javax.swing.JFrame;
    import javax.swing.JSplitPane;
    import javax.swing.JTextArea;
    public class SplitPaneFrame extends JFrame implements PropertyChangeListener  {
         public SplitPaneFrame()  {
              super ("Split pane test");
              //  Create the components to show in the split pane
              myTopComponent = new JTextArea ("This is the top component", 10, 40);
              myBottomComponent = new JTextArea ("This is the bottom component", 15, 40);
              //  Create the split pane
              mySplitter = new JSplitPane (JSplitPane.VERTICAL_SPLIT , true, myTopComponent, myBottomComponent);
              mySplitter.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, this);
              getContentPane ().setLayout(new BorderLayout ());
              getContentPane ().add (mySplitter, BorderLayout.CENTER);
         public void propertyChange (PropertyChangeEvent evt) {
              if (evt.getPropertyName () == JSplitPane.DIVIDER_LOCATION_PROPERTY)  {
                   System.out.println ("Split pane divider moved");
                   Dimension size = myTopComponent.getSize ();
                   System.out.println ("    The top component's size is: " + size.height +" h, "+ size.width + " w");
                   myBottomComponent.getSize (size);
                   System.out.println ("    The bottom component's size is: " + size.height +" h, "+ size.width + " w");
                   mySplitter.getSize (size);
                   System.out.println ("    The splitter's size is: " + size.height +" h, "+ size.width + " w");
                   System.out.println ("    The splitter divider location is: " + mySplitter.getDividerLocation ());
         private JTextArea myTopComponent;
         private JTextArea myBottomComponent;
         private JSplitPane mySplitter;
         public static void main(String[] args) {
              SplitPaneFrame appFrame = new SplitPaneFrame ();
              appFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              appFrame.pack();
              appFrame.setVisible (true);          
    }

  • How to capture the company code changes

    Hi Experts,
               I need to capture the delta changes of company code which update the T001 table.( i.e. if there is any modification on existing company code or new company code created ). I couldn't find Userexit for OX02 and ec01 Tcodes. please suggest me how to achieve this, looking forward to here from all.
    Usefull answers will be rewarded,
    thanks in advance,
    Tom

    Try SCU3 transaction, as the T001 table has the "Log Data Changes" ON.
    Regards,
    Naimesh Patel

  • How to Capture the event when minimized button is clicked of a JFrame?

    Hi All,
    In my SWING application, I want to do something when the minimized button is clicked. But not able to understand how to do that.
    My basic requirement is like that, if I minimize the JFrame, it should be minimized to system tray with an icon. Again when the icon is clicked, the frame should be maximized in the Windows.
    Also, how to make my JFrame visible/invisible. If I close it, then the process will got killed... that I don't want to happen. Should I us setVisible(true/false) for the frame... Please suggest...
    Thanks,
    Ujjal

    There could be some mistake in my basic understanding... Anyway this is what I wrote...
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    public class WindowIconify extends JApplet
         JFrame jf;
         JPanel jp;
         public void run()
              jf = new JFrame("test");
              jf.setSize(200,200);
              jp = new JPanel();
              jp.setBackground(Color.BLACK);
              jf.add(jp);
              jf.setVisible(true);
         public boolean handleEvent(Event event)
              if ( event.id == Event.WINDOW_ICONIFY)
                   System.out.print("iconifying");
              return true;
         public static void main(String args[])
              WindowIconify wi = new WindowIconify();
              wi.run();
    }

  • How to find the event time segment details from delivery document

    Hi,
    In the delivery document at header level in Dates tab i have maintained begining Plan date where Event = Shipment.
    But that field is in structure.
    How to fetch those(Begining Plant Date) details in to report,
    I have tried from Function module side also, i have not found any function module which is related to this field.
    If any body give some solution, that will be great help for me.
    Regards
    Lakshmikanth

    I have tried with those table(TSEGH & TSEGE), i have not found the begin plan date for that event. where event = shipment.
    We are using 4.7 version. Here we have found one function module: TSEG_DIALOG_DATA, but iam unable to find the input details.
    Here the input options are:
    IF_HANDLE
    IF_DIALOG_VIEW
    IF_DIALOG_ZONE
    May i know what are these inputs, what exactly i have to pass to this function module.

  • How to capture the current info in the top-of-page event in Reuse block dis

    How to capture the current info in the top-of-page event in Reuse block dis

    Hi Geetha,
         If you don't have any information to pass the Heading Block, then why you are using this event ?
         please comment/ remove that TOP_OF_PAGE code. and use subtotal code in field catalog block.
          you can use below code for subtotal. 
          FORM field_catalog .
                    gs_fcat-do_sum = &2.
              fcat : 'WRBTR' '15' 'X' ' ' ' ' 'WRBTR' 'Amount',
           ENDFORM.
           Regards,
           Kunjan

  • How to capture the changes in ppoma_crm transaction

    Hello All,
    We have a requirement that if we add either a BP or an User to a positon in ppoma_crm transaction then we should be able to update these entries in our z table.
    If it is a BP then we should look for the User mapped to it and update the z table else we should directly update the z tables with user name.
    But we are facing an issue in capturing the values that have been updated.
    Can anyone tell me how to capture the new values in the BADI for the ppoma_crm transaction ?
    Regards
    Sohit

    Did any guys here face the requirement? If replicating all the columns some of which may change frequently but are not important to the other sites, then i wouldn't replicate these changes in order to improve the performance. Thanks for your help!

  • How to capture the product change on the item level in CRM GUI.

    Dear All:
    There is a line item in the sales order. Now I change the product of the line item. I want to capture the change in CRM GUI.
    PS:
    There is a reference thread, in which I know we can capture the change in WebUI with the component T115IT_SLSO.
    Can the old product be captured after I changed the product in order item?
    But I want to know how to capture the change in GUI. Anybody can help me? Thanks in advance.

    Hi,
    when you create an item in GUI tcode CRMD_ORDER, badi CRM_ORDERADM_I_BADI will be triggered.
    Method CRM_ORDERADM_I_PRODUCT_DETERM will have the Header and item guid and newly entered product in parameter IV_ORDERED_PRODUCT.
    Regards,
    Arun

  • How to capture the changes of the specified fields?

    Dear all,
    I wanna capture the specified columns' changes according to the requirement but not all the table columns' changes. For the reason that some of the columns in the table are changed frequently but not so important to the application at the dest site. So avoiding replicating these columns, the replication performance can be improved greatly. How to configure at the source site? Oracle :10gr1
    Appreciated for your kindly help.
    Br,
    MSN:[email protected]

    Or you can create rules on the negative rule set of the capture process to filter out LCRs when only the unwanted columns were changed.
    More specifically, you add a negative rule set rule that evaluates to TRUE when none of the wanted columns has the OLD value different from the NEW value (beware of nulls, you'll have to use a combination of IS NULL/IS NOT NULL expressions to do that).
    This will make the unwanted LCRs to be discarded at capture time, avoiding overhead in propagation and apply, as you want.
    Of course you will still have to create a custom handler to remove the unwanted columns, because you can have the situation when an LCR contains updates on both wanted and unwanted columns. This LCR would not be filtered out by the negative rule.
    Ilidio.

  • How can I capture the event of selecting a listbar page item?

    Is there any way that I can capture the event of clicking/selecting a listbar page item (not just selecting the listbar page) from the listbar activeX control in TestStand 3.0?
    I was able to populate the list bar page with items, now how do I know if a user selects any one of those items?
    Thanks for your time and assistance,
    Mark

    Use the CursorMoved event.

  • How to Capture Button event on TrainBean navigation

    Hi All
    i m being required to capture a button event in train bean Navigation, i m doing customization in Iexpense Module,here in Create IExpenseReport i need to capture the events of Remove,Return etc.how is it possible any clue would be very helpful.
    Thanx
    Pratap

    try this..
    if (GOTO_PARAM.equals(pageContext.getParameter(EVENT_PARAM))
    "NavBar".equals(pageContext.getParameter(SOURCE_PARAM))
    // This condition checks whether the event is raised from Navigation bar
    // and Next or Back button in navigation bar is invoked.
    int target = Integer.parseInt(pageContext.getParameter(VALUE_PARAM));
    // We use the parameter "value" to tell use the number of
    // the page the user wants to visit.
    String targetPage;
    switch(target)
    case 1: targetPage = "/oracle/apps/dem/employee/webui/EmpDescPG"; break;
    case 2: targetPage = "/oracle/apps/dem/employee/webui/EmpAssignPG"; break;
    case 3: targetPage = "/oracle/apps/dem/employee/webui/EmpReviewPG"; break;
    default: throw new OAException("ICX", "FWK_TBX_T_EMP_FLOW_ERROR");
    HashMap pageParams = new HashMap(2);
    pageParams.put("empStep", new Integer(target));
    pageContext.setForwardURL("OA.jsp?page=" + targetPage,
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    pageParams,
    true, // Retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrumbs
    OAWebBeanConstants.IGNORE_MESSAGES);
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to capture the Logout time in xMII

    Hi Friends,
    How to capture the logout time in xMII when the user clicks on Logout link
    Thanks

    Srikanth,
    It would be better to use a database table(s) to store your audit trail information than an xml file, which could grow beyond a manageable size and then require housekeeping efforts and file rolling, etc.  It would also be much easier to query user related information out of the logs, pareto charts for failed vs. successful login attempts, etc. if the data was stored in a database.
    Have you considered modifying the Relogin.jsp page link in the portal's sub-menu bar?  How about making your own version of this web page and changing the link pointer?  Keep in mind that whatever result you come up with here will need a significant update for NetWeaver UME compatibility in version 12.0.
    Regards,
    Jeremy

  • How to capture the date and time of  a background job

    Hi experts,
    How to capture the date and time of  a background job?
    How to find whether it is runned succesfully or not?
    If it is not successful how to put error message?
    ASAP
    Thanx in advance,
    Sudha

    To Display the STATUS of the JOB which is exectued in background
      CLEAR : wa_jobsteplist.
      REFRESH : i_jobsteplist.
      WRITE:/ 'DISPLAYING JOB STATUS'.
      CALL FUNCTION 'BP_JOB_READ'
        EXPORTING
          job_read_jobcount           = w_jobcount
          job_read_jobname            = w_jobname
          job_read_opcode             = '20'
        JOB_STEP_NUMBER             =
       IMPORTING
         job_read_jobhead            = wa_jobhead
       TABLES
         job_read_steplist           = i_jobsteplist
    CHANGING
       RET                         =
       EXCEPTIONS
         invalid_opcode              = 1
         job_doesnt_exist            = 2
         job_doesnt_have_steps       = 3
         OTHERS                      = 4
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    To Display the status text as per the status type
      CASE wa_jobhead-status.
        WHEN 'S'. WRITE: / 'Scheduled'.
        WHEN 'R'. WRITE: / 'Released'.
        WHEN 'F'. WRITE: / 'Completed'.
        WHEN 'A'. WRITE: / 'Cancelled'.
        WHEN OTHERS.
      ENDCASE.

Maybe you are looking for

  • How to print Arabic characters in Oracle BI Publisher report

    Dear Experts, Kindly suggest me how to print arabic characters in BI Publisher. Regards, Mohan

  • Simple Button Listener not so simple

    Here is code that works fine without the Listener: myButton_Zoom = function () { bt_zoombig_mc._visible = !bt_zoombig_mc._visible; Now when I try to add a listener it will not listen. Here is the code with the Listener: listener = new Object(); liste

  • Create XML file with worksheet's dynamically assigned through XSLT

    Hi all I have a requirement to create a xml file with worksheets dynamically created based on a field value in the internal table . I have all my values in internal table,  and am calling the transformation from bsp application. Say the internal tabl

  • Strange problem with loading pages.

    With little warning, my Firefox began to act strangely. When I would attempt to load or refresh a page, it would not respond. The tab would show the loading animation, but it would be frozen. Confused, I began to move my mouse to try and figure out w

  • How to get rid of trojan horses

    whats the best way to get rid of trojan.download. this is my first mac. i just want the best product for my computer(love my mac).