How to pass the KeyEvent from one component to other

I am able to get a key event for a scroll bar from that scroll bars key listener. Now i want to pass this key event to another components key listener. How can i do this.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class KeyCommunication
    public static void main(String[] args)
        final JScrollBar
            left  = new JScrollBar(JScrollBar.VERTICAL),
            right = new JScrollBar(JScrollBar.VERTICAL);
         * if KeyEvent originates with left, forwards KeyEvent to right
        left.addKeyListener(new KeyAdapter()
            public void keyPressed(KeyEvent e)
                int keyCode = e.getKeyCode();
                int direction = 0;
                if(keyCode == KeyEvent.VK_UP)
                    direction = -1;
                if(keyCode == KeyEvent.VK_DOWN)
                    direction = 1;
                left.setValue(left.getValue() +
                              left.getBlockIncrement(direction) * direction);
                if(e.getSource() == left)
                    right.dispatchEvent(e);
         * forwards KeyEvent to left scrollbar if KeyEvent originates here
        right.addKeyListener(new KeyAdapter()
            public void keyPressed(KeyEvent e)
                int keyCode = e.getKeyCode();
                int direction = 0;
                if(keyCode == KeyEvent.VK_UP)
                    direction = -1;
                if(keyCode == KeyEvent.VK_DOWN)
                    direction = 1;
                right.setValue(right.getValue() +
                               right.getBlockIncrement(direction) * direction);
                if(e.getSource() == right)
                    left.dispatchEvent(e);
         * paints track of focused scrollbar blue
         * use tab key for navigation between scrollbars
        FocusListener l = new FocusListener()
            Color bgColor = UIManager.getColor("ScrollBar.background");
            public void focusLost(FocusEvent e)
                JScrollBar scrollBar = (JScrollBar)e.getSource();
                scrollBar.setBackground(bgColor);
                scrollBar.repaint();
            public void focusGained(FocusEvent e)
                JScrollBar scrollBar = (JScrollBar)e.getSource();
                scrollBar.setBackground(Color.blue);
                scrollBar.repaint();
        left.addFocusListener(l);
        right.addFocusListener(l);
        JPanel panel = new JPanel(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.insets = new Insets(10,0,10,0);
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.fill = gbc.VERTICAL;
        panel.add(left, gbc);
        panel.add(right, gbc);
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(panel);
        f.setSize(400,400);
        f.setLocation(200,200);
        f.setVisible(true);
}

Similar Messages

  • How to pass the values from one screen to another

    HI,
    consider me21n,
    po is created with the item category L,so components tab is enabled.that u all know.
    i have added the custom tab in the item details with netwt,gross wt,no of pieces and one more field.
    those fields are also in component structure of material data.
    i need to pass the matnr,maktx,quantity,ntwt,grosswt from the component to be displayed in  the subscreen.
    i used import mdpm to xmdpm from memory id 'subcon',  where it is exported from the function module 'me_components-maintain'.
    how to pass  all the values from component of structure MDPM to the subscreen of custom tab in the item details.
    help me pls........................'

    hi everyone,
    MODULE status_0111 OUTPUT.
    data : fill type i.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.,
      DESCRIBE TABLE lt_zzmm_po_comp LINES fill.
      ctrl_0111-lines = fill.
    ENDMODULE.                 " STATUS_0111  OUTPUT
    MODULE fetch_data OUTPUT.
      ctrl_0111-lines = 2.
    import xmdpm to lt_xmdpm from memory id 'SUBCON'.
    IF not sy-subrc eq 0.
        CLEAR lt_zzmm_po_comp[].
        LOOP AT lt_xmdpm.
          MOVE-CORRESPONDING lt_xmdpm TO lt_zzmm_po_comp.
          APPEND lt_zzmm_po_comp.
        ENDLOOP.
    MOVE-CORRESPONDING lt_zzmm_po_comp TO ctrl_0111.
      read table ctrl_0111-cols into col where index = 3.
      ENDIF.
    ENDMODULE.                 " FETCH_DATA  OUTPUT
    MODULE pass_line OUTPUT.
      READ TABLE lt_zzmm_po_comp INDEX ctrl_0111-current_line.
      MOVE-CORRESPONDING lt_zzmm_po_comp TO ctrl_0111.
    ENDMODULE.                 " PASS_LINE  OUTPUT
    flow logic
    PROCESS BEFORE OUTPUT.
    MODULE status_0111.
    MODULE FETCH_DATA.
    loop at lt_zzmm_po_comp WITH CONTROL ctrl_0111 cursor
    ctrl_0111-current_line.
       module pass_line.
    endloop.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0111.
    loop.
    *module read_data.
    endloop.
    but i cant see my fields in the table control .....i dont know y it is  not coming?can anyone help me with code...

  • How to move the changes from one system to other without using CMS

    Hi
    In our project they are migrating NWDI 6.40 to NWDI 7.0.
    During migration CMS won't be available.
    Could you plesae tell what are the different options are there to move the WebDynpro changes from (NWDS) Development to Quality system and then production system without using CMS server?
    If i will create a development package and import this packgae in Quality package will my new changes also be available in Quality server?
    Thanks & Regards
    Susmita

    Hi Susmita
    I wasn't completely sure, but from your description of your problem, it seemed like you would have access to your DTR during your upgrade. The following solution assumes as much. If this is not the case, you'll need to do things slightly differently, but the solution will still be possible.
    Depending on the scope and size of your changes, it may be practical for your developers to deploy directly from their NetWeaver Developer Studio (or for a designated administrator to install the NWDS and do the same). To do so, from the Development Configurations perspective, create a new NWDS project for each of the DCs you want to deploy. Then right-click the project and choose from one of the deployment options. (Deploy new archive and run will allow you to see if your deployment has taken effect.) When deploying, the target server is the one set up as your J2EE engine in the NWDS properties - you'll consequently have to modify this when the target server for your deployment changes (from QA to production, or vice versa).
    Note that this is only applicable in certain situations, and only as a short term stopgap measure. This sort of practice - developers or administrators deploying haphazardly to servers other than those intended for development - is precisely what the NWDI is designed to prevent (and is one of very few things it's fairly good at doing). For instance, if your QA and production systems are attached as TEST and PROD runtimes systems respectively in your NWDI, a full assembly and subsequent full deployment would usually occur to these servers when deploying with the NWDI. This is a much stronger guarantee of consistency than the build that will be performed within your local NWDS to deploy your changes. (Conversely, the rigidity of the assembly is perhaps the NWDI's greatest design flaw.)
    (Also, Snehal: thanks for the information on the sapmake_util blog. It's not something I've encountered before and looks very useful.)
    James

  • How to pass the value from one level to another level

    Example :
    we have secnario for leave process
    initiall the user enters the name in first action the personal number should pick from first action to background RFC CO to pick the Payroll admin from R/3
    i designed the first data input form.... i want to pick the personal number and pass that one to next action in background mode.
    thanks in advance
    sukumar

    Hi,
    If you want to execute the step in background then you can use the callable object of type "Background Execution" or if you want to do any user interaction on that step then you can go for web dynpro callable object. Here is the link for Background Execution callable object.
    http://help.sap.com/saphelp_nw70/helpdata/en/9a/e8934258a5ca6ae10000000a155106/frameset.htm
    Here is also link for Web Dynpro Callable Object
    http://help.sap.com/saphelp_nw70/helpdata/en/de/8976417f2d5558e10000000a1550b0/frameset.htm
    If you have any conficution please let me know.
    Thanks
    Chandan

  • How to pass the value from one page to another page

    Dear Gaurav
    I have three pages
    1-creation page
    2-search page
    3-creation page
    in first creation page I have column name user write a% and submit to that search for that name.
    it is going to second page (search page)name a% is passed and search that corresponding value,the corresponding values are not there user will call third creation page and enter the details and save and click back to first page the value is not calling passing from third page to first page I submit the button in 3rd page the error is coming like this.
    The requested page contains stale data. This error could have been caused through the use of the browser's navigation buttons (the browser Back button, for example). If the browser's navigation buttons were not used, this error could have been caused by coding mistakes in application code. Please check Supporting the Browser Back Button developer guide - View Object Primary Key Comparison section to review the primary causes of this error and correct the coding mistakes.
    Cause:
    The view object xxcrmleadmgmtAM.xxcrmleadmgmtVO contained no record. The displayed records may have been deleted, or the current record for the view object may not have been properly initialized.
    in first page column name I removed view instance and view attribute the value is passing from third page to first page
    my requirement is the value call from 3 to 1 and user will enter remaining fields in 1st page and save the records.
    Regards
    Mahesh

    Hi Mahesh,
    Use
    OA.jsp?page=/oracle/apps/................&retainAM=Y).
    Thanks
    Jegan

  • How to pass a value from one component to another component in webdynpro

    I have created component which consists of alv display and in the alv table  I have created pernr has link and when I click that pernr the second webdypro component opens which I have created . now in the second component I want that pernr value. based on that I want to fetch some data.

    See i have this code for example which calls the browser with concatenated URL:
    CONSTANTS: l_c_url_part1 TYPE string VALUE '?sap-system-login-basic_auth=X&sap-client=',
                         l_c_url_part2 TYPE string VALUE '&sap-language=EN',
                         l_c_url_part3 TYPE string VALUE '&PARAMETER1=',
                         l_c_url_part4 TYPE string VALUE '&PARAMETER2='.
    CALL METHOD cl_wd_utilities=>construct_wd_url
                   EXPORTING
                     application_name = 'ZTEST'
                   IMPORTING
                     out_absolute_url = l_v_url.
                 CONCATENATE l_v_url  l_c_url_part1
                             sy-mandt l_c_url_part2 l_c_url_part3 'VALUE1' l_c_url_part4 'VALUE2' INTO l_v_url.
                 CALL FUNCTION 'CALL_BROWSER'
                     EXPORTING
                       url                           = l_v_url1
                       new_window             = 'X'
                     EXCEPTIONS
                       frontend_not_supported = 1
                       frontend_error         = 2
                       prog_not_found         = 3
                       no_batch               = 4
                       unspecified_error      = 5
                       OTHERS                 = 6.
                   IF sy-subrc <> 0.
                     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                   ENDIF.

  • How to pass date parameter from one page to other in BSP application

    Hello gurus,
    In my BSP application i have taken an input field and made its type "date" and its value also of type date and have set showhelp .
    Now once a particular date is given as an input i want to pass its value to next page. And in next page i have to fire a query based on the date entered in previous page...
    Now my prb is that my date value is not getting passed to the next page.
    I have used
    navigation->set_parameter( name = 'BEGDA' value = BEGDA ).
    to pass date parameter.....still parameter is not getting passed.
    plz help me with this.....
    thankx.....

    Hi Eddy,
    By truncation i mean the entire date becomes 10 char including the ' . ' eg(06.12.2006).
    so with begda being 8chars it takes my date as 06.12.200
    as a result my query is not getting executed.
    now i have tried to use a FM  'CONVERT_DATE_TO_INTERN_FORMAT'.
    in my 1st page but still in 2nd page its giving me following error.
    <b>The data that was read could not be written to the specified target field during a SELECT access. Either the conversion is not supported for the type of the target field, or the target field is too short to accept the value, or the data is not in the appropriateformat for the target field.
    </b>
    Regards
    Swati

  • How to copy the variants from one user to other user?

    Hi all,
    I have a list of variants(nearly 10 variants) for a report named 'ZONEORDER'. I need to copy all the variants to another user. Is it possible?
    If so, could anyone suggest the solution?
    Thanks in advance.
    Regards,
    Vijay.

    Hello Vijay,
    I need to copy all the variants to another user.
    What does " copy to another user" mean?
    You can attach the variant to a Transport through prog. RSTRANSP and move to subsequent systems.
    BR,
    Suhas

  • How to pass control from one component to other component

    Hi,
    I have a requirement to pass control from one component to other component.
    Here is my requirement.. l have two portal components, one is search component and other is result component. I have this search component as quick navigation iView where we can enter a value and results will display in results iView, it's a main iView.
    When search view gets the results, I will display the count in search view and result in results view. .i.e.. both the iviews are viewed at any time.
    Can any one advise me how to acheive this.
    Thanks,
    Chinna.

    Hi Sandeep,
    Thanks for the reply. I have gone through the EPCF API, and tried with doNavigate('iViewName').
    when I click on the button in search view (quikc navigation frame), instead of page getting refreshed in result iView, whole page is replaced by results iview. I want only search view and results view gets refreshed.
    can you please tell me which even should I use for this scenario...
    Thanks,
    Chinna

  • How can I pass the photos from one iphone to another?

    how can I pass the photos from one iphone to another?

    Use the Beaming feature. See the info at the ? In iPhoto for iOS.

  • How to pass the data from a input table to RFC data service?

    Hi,
    I am doing a prototype with VC, I'm wondering how VC pass the data from a table view to a backend data service? For example, I have one RFC in the backend system with a tabel type importing parameter, now I want to pass all the data from an input table view to the RFC, I guess it's possible but I don't know how to do it.
    I try to create some events between the input table and data service, but seems there is no a system event can export the whole table to the backend data service.
    Thanks for your answer.

    Thanks for your answer, I tried the solution 2, I create "Submit" button, and ser the mapping scope to  be "All data rows", it only works when I select at least one row, otherwise the data would not be passed.
    Another question is I have serveral imported table parameter, for each table I have one "submit" event, I want these tables to be submitted at the same time, but if I click the submit button in one table toolbar, I can only submit the table data which has a submit button clicked, for other tables, the data is not passed, how can I achieve it?
    Thanks.

  • Passing the values from one pgm to another pgm (Calling pgm has no sel scr)

    Hi gurus,
    In my requirement i need to pass the values from one program to another program.
    I am using SUBMIT statement . But , the program which i am calling has no selection screen.
    So how can i pass the values?
    Please help me ASAP.
    Regards,
    Bhanu.R

    Export your internal tables or work areas to a memory id in ur program before u use submit.
    Then in second pgm you have to import from memory id given above.
    example.
    EXPORT gs_header FROM gs_header to memory id 'HEADER'.
    EXPORT gt_item FROM gt_item to memory id 'ITEM'.
    SUBMIT YFIIN_DISHC_MAILREPORT EXPORTING LIST TO MEMORY AND RETURN.
    In your second pgm you can write
    import gs_header TO gs_header from MEMORY id 'HEADER'.
    import gt_item TO gt_item from MEMORY id 'ITEM'.

  • Reading the data from one component view into another component view

    Hi All,
    I have requirement to read the data from one component into another component while creating the service order. Here are the details.
    Main View for Service order: BT116H_SRVO in that we have two assignment blocks like Organizational data(BTORGSET) and amount allocation(BTAMNTALL).This two blocks are two different component which are associated with main component(BT116H_SRVO).
    I need to read the sales org data from component/View(BTORGSET/Orgsetdata) into Component/View(BTAMNTALL(HdrBillPlanDet) method DO_VALIDATE_INPUT.
    I searched in SDN but all the posts are related to the data exchange between two views in same component. But My scenario is different as explained above.
    Refer the attachments for the component link..
    Please let me know how we can achieve this one..
    Thanks,
    Sapsar.

    Finally I was able to fix my code...My Mistakes were need to read the parent node above three levels and need to use the relation entity name while reading the data..
    Below is the correction code
    IF iv_index IS NOT INITIAL.
         lr_iterator ?= collection_wrapper->get_iterator( ).
         lr_current ?= lr_iterator->get_by_index( iv_index ).
         lr_entity ?= lr_iterator->get_by_index( iv_index ).
       ELSE.
         lr_current = collection_wrapper->get_current( ).
       ENDIF.
    *loop back to root entity
             WHILE lr_entity->get_name( ) NE 'BTAdminH'.
               lr_entity = lr_entity->get_parent( ).
             ENDWHILE.
    *Get the related entity
             IF lr_entity IS BOUND.
               lr_collection ?= lr_entity->get_related_entities( iv_relation_name = 'BTHeaderOrgmanSet' ) .
               IF lr_collection IS BOUND.
                 lr_orgset_m = lr_collection->get_current( ).
    *            lr_orgset = lr_orgset_m->get_related_entity( iv_relation_name = 'BTOrgSet' ).
                 lr_orgset = lr_orgset_m->get_property_as_string( 'SALES_ORG' ).
               ENDIF.
             ENDIF.
    Thanks,
    Sapsar.

  • HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?

    HI,
    HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?
    thanks,
    samba.

    By selection screen, what do you mean?   There is no selection screen in WDA as there was in classic dynpro. Do you mean you are using the Select-Options reusable component?  Are you wanting to call a standard transaction via ITS - SAPGUI for HTML?  Please provide more details to your question.

  • How to pass a parameter from one action1 in block1 to action2 in block2.

    Dear Experts,
    How to pass a parameter from one action1 in block1 to action2 in block2.
    My Process Structure is as follows..
           Process
                Sequential Block
                     Action 1
                     Parallel Dynamic Block
                             Sequential Sub Block
                             Action 2.
    while i am  trying to execute the action1 the following error is shown below:
    Cannot complete action: The activity could not be read.
    Please suggest me how to do?
    Regards,
    Rajesh N

    Hello Rajesh!
    I think you are talk about the mapping parameters of your process.
    This case in design time of your workflow, you have the vision of your blocks and actions, you have on action 1 the output parameter and you have the action 2 an input parameter.
    So you have that make a group mapping on your process, map in this group the action1 outpu parameter with the action2 input parameter.
    Regards, Ronaldo Rampelotti

Maybe you are looking for

  • New system, MSI X800XT PCI-E Issues

    Hi there! I just bought a new motherboard, new ram, new cpu and new videocard and was eagerly wanting to set this stuff up.   My system is now as follows: Motherboard: MSI 925X Neo-54G CPU: P4 3.40Ghz (1 Mb L2 Cache) (Socket 775) RAM: 1 GByte DDR2 53

  • Podcast not updating in iTunes application

    My podcast shows up fine in my RSS feed on my server.  It shows up fine in the iTune Store. My podcast is NOT showing up in my iTunes Application feed and shows the like there is a broken link somewhere when I try to "Update Podcast". My RSS feed: fe

  • Require Fields Before Printing

    I've been looking through the documentation of Adobe Live Cycle Designer and cannot find my answer. I have two fields, which I would like to be required. Upon a user pressing the print button, if these fields are empty, require it before the form wil

  • SQL Question - Interesting One

    I need to write a SINGLE SQL statement which has two different queries, if the first query retrieves records then there is no need to execute the second one, if the first query doesn't retrieve the records then I need to make use of second query to r

  • Why is one time vendors created

    Why is one time vendors created ?What is the use?How is it different from other vendors?