How to trigger an event by using

Hi all,
I have created a jbutton and an event for the jbutton, for example,
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)Now, I would like to trigger the event by pressing a hot key, for example "F1", how can i make it? Can anyone help me? Thanks.
Ning.

Hi,
I have read through the information that you provided and tried to integrate it into my coding, but I'm really not so clear about that and i don't know how to apply into my coding correctly......can anyone help me? Thanks.
I'm creating an application using the J2SE v 1.4.2_10 SDK with NetBeans 4.1 Bundle. By the way, below is a simple testing program that including component jLabel1, jButton1 and jButton2. Both of the button are hold an event each. I would like to create a hotkey for each button, "F1" key for jButtton1, "F2" key for jButton2. If I click on the "F1" key, the jLabel1 will displays the character "ABC", if I click on the "F2" key, the jLabel1 will display the character "123". Can anyone provide the code to me? Thanks.
* test.java
public class test extends javax.swing.JFrame {
    /** Creates new form test */
    public test() {
        initComponents();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        getContentPane().setLayout(null);
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jButton1.setText("ABC");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
        getContentPane().add(jButton1);
        jButton1.setBounds(90, 70, 90, 23);
        jButton2.setText("123");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
        getContentPane().add(jButton2);
        jButton2.setBounds(191, 70, 80, 23);
        jLabel1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
        getContentPane().add(jLabel1);
        jLabel1.setBounds(110, 134, 150, 20);
        setBounds(20, 20, 400, 300);
    // </editor-fold>
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
        jLabel1.setText("123");
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
        jLabel1.setText("ABC");
     * @param args the command line arguments
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new test().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration
}Ning.

Similar Messages

  • How to trigger left_click_run event on ALV GRID

    Hiiiiiiii........
    Can any of u please tell me how to trigger left_click_run event on ALV GRID.
         There is an event LEFT_CLICK_RUN and  its a public accessed event. But the problem is , the corresponding  attribute of this event  "EVENT_LEFT_CLICK_RUN" which is needed to registered that event (We need to register our events through a method set_register_events  using table of type cntl_simple_events...) is protect accessed. So I am unable to use that attribute...Could u please tell  me is there any alternative way to register that event.......ANY POSSIBLE WAY?
    Thanks in advance,
    Rams

    I think you should use event selection_changed. Note that you shouldn't allow multiple selection for the tree at the same time, i.e. use: create object g_tree exporting \[...\] node_selection_mode = cl_gui_column_tree=&gt;node_sel_mode_single.
    For more information, see this thread: Urgently required :  cl_gui_alv_tree single_click event...

  • How-to trigger a process chain using ABAP?

    Does anybody know how to trigger a process chain using ABAP code?
    Any help would be appreciated!
    Thanks
    Ioan

    Hi Ioan,
    try this in your ABAP:
        CALL FUNCTION 'BP_EVENT_RAISE'
          EXPORTING
            eventid         = 'Your Event'
            eventparm       = 'START'
            target_instance = ' '
          EXCEPTIONS
            OTHERS          = 01.
    and schedule your process chain, waiting for 'Your Event'.
    regards
    Siggi

  • How to trigger an event in the program

    Hi,
    I have a program. The purpose of the program is to retrieve the data matching the selection criteria and downlod the same to a file.
    In the selection screen, I have a parameter called 'EVENT'. Here, user enters some event name. Generally, they enter the 'Background job processing events'.
    So, my requirement is... once the files are successfully downloaded, the program should trigger the 'EVENT' specified in the selection screen at run time.
    Can someone help me in this regard. How to trigger an EVENT in the program. Is there any Function Module or Method available in SAP which triggers the EVENT at runtime.
    And is there any table available in SAP which stores all the events available in SAP. Because, whenever the user enters an EVENT in the selection screen, we should check whether the event is valid or not. So, if there is any table available which has all the events then, it will be easy I guess. or is there any other way to validate the EVENT name.
    Please help me. Thanks in advance,
    Best Regards,
    Paddu.

    Hello Paddu,
    have a look at tables
    - btcsev, btcsed (system events)
    - btcuev, btcued (user events)
    and use function BP_EVENT_RAISE.
    kind regards
    Walter Habich

  • How to trigger a event when WBS gets changed in Cj02

    Hello,
    I have a requirement where I need to send create an idoc and send the idoc to external system when WBS is created or changed.  Currently, I have the following setup:
       - I have created a YBUS2054 as a subtype of BUS2054 using SWO1
       - YBUS2054 has been delegated to BUS2054
       - created an CHANGED event in the YBUS2054. This event is implemented and then released
       - created a type linkage (object type=YBUS2054, event=CHANGED, receiver type null, and receiver function module = zz_create_wbs_idoc) using SWETYPV. This function is supposed to create an idoc when CHANGED event occurs. I just don't know how to trigger the event to occur.
       - all the port, define idoc type, logical system, and etc are setup
       - when I try to create an entry in "Event for Chagne Document" using SWEC with change doc object=PROJ, business object type = YBUS2054, with on change, I get "Key for change doc object PROJ and business object type YBUS2054 are incompatible".
    I tried various configurations, and I was not successfully in creating an event on CHANGED
    can you please advise what I am missing in getting the changed event to trigger?
    Thank you in advance,
    Shawn

    Hi,
    If the change doc doesnt exist, check if you can create an event using BSVW.
    Also use the event log to see if there are other sap standard events happening.
    I checked the package belonging to CJ02 to see if there is something useable, but didn't find anything: CN_PSP_OPR
    If there are no sap standard ways to get an event, you'll have to find a badi/enhancement spot and include some coding to start the event using fm SAP_WAPI_CREATE_EVENT.
    Kind regards, Rob Dielemans

  • Dictionary Search Help - how to trigger an event after F4 help

    Hi,
    I been searching the web lately to find a way to trigger an event after using the F4 input help.
    Here is an example of what I would like to do:
    - I have a WD form with a inputfield in it.
    - The input field is bound to datalement "LIFNR".
    - In my context I have specified the Input Help Mode to "Dictionary Search Help"
    - And the Dictionay Search Help is set to "KRED"
    A user will the click on F4 to start the Search help, then pick a LIFNR and the WD inputfield wil be filled.
    What I want is to trigger an event when this is happening.
    Does anyone have som tips or guides for me regarding this problem?
    Thanks in advance! =)

    Hi Mathias Hagen
    Actually there is no straight way of doing this , but still you can trigger a event in F4 search help ...  below is very informative blog to trigger the F4 search help by chris
    Firing a WDA event on using a Search Help - how to do it, without an NDA
    regards
    Chinnaiya P

  • How to trigger New page while using ALV with classes/oops?

    Hi All
    I am trying to print a report which has to show the data in two pages.
    I am using ALV with classes/oops.
    Though I am able to print the report but a new page is not coming. Whole of the data is coming in one single page.
    Please tell me as to how to trigger a NEW PAGE while using ALV with classes/oops.
    Please send some code samples also if available.
    Thanks in advance.
    Jerry

    using sort option you can do it. in case of grid/oo alv class ALV you can view that only in print mode/preview mode.
    in case of list you can view that directly.
    sort-fieldname = 'FIELDNAME'.
    sort-group = '*'  "triggers new page
    sort-up = 'X'.
    append sort to it_sort.

  • How to trigger own events?

    How can you create your own events to be triggered?
    For instance, I have an InputStream that I've got through a Socket that's listening for incoming data. I want to signal/trigger an event when data comes in so that the gui (in another class) can take appropriate actions. How can you do this?

    The basic idea is this:
    public interface SockeListener
        void dataEvent(/* pass a parameter if needed.  Often an event interface is added */);
    public class MySocket
         private final List listeners = new ArrayList();
         public void addListener(SocketListener listener)
              listeners.add(listener);
         public void removeListener(SocketListener listener)
              listeners.remove(listener);
         private void triggerEvent()
               for (Iterator i = listeners.iterator(); i.hasNext();)
                    ((SocketListener) i).dataEvent();
    }Check out the PropertyChangeSupport class also.

  • How to trigger an event when a job is cancelled

    Hi,
    Can anyone help me out wid a transaction that will trigger an event when a job is
    cancelled....??
    My scenario is :
    When a job is cancelled (SM37) or in cancelled status  i want notify to certain ppl thru emails.
    How do i go abt doing the same??
    Its Urgent...
    Answers will be rewarded.
    regards,
    Rohan

    Hi,
    please check out the link below it might help you
    http://help.sap.com/saphelp_nw2004s/helpdata/en/71/a8a77955bc11d194aa0000e8353423/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/97d2e8b3-0b01-0010-b787-b8ce558a51c2
    for table name and list of function please check out the links below it will help you
    http://www.erpgenie.com/sap/abap/tables_system.htm
    http://www.sap-img.com/abap/function-list.htm
    **************please reward points if the information is helpful to you**********

  • How to trigger an event?

    hi,
    could i trigger an event in workflow A by using "Post Internal XML Event"
    workflow B?
    must i use JMS to trigger it?
    Thanks.
    * Name: Gary Wang
    * Tele: 010-65546668-8119
    * Mail: [email protected]

    Gary
    You can use JMS (preferably JMS Header properties for performance, or
    XML document), or you can use the api and invoke a business operation as a
    bean or java class
    Tony
    "Gary" <[email protected]> wrote in message
    news:3c2c0379$[email protected]..
    hi,
    could i trigger an event in workflow A by using "Post Internal XML Event"
    workflow B?
    must i use JMS to trigger it?
    Thanks.
    * Name: Gary Wang
    * Tele: 010-65546668-8119
    * Mail: [email protected]

  • How to trigger wd event in flex

    Hi,
    I want to trigger an event in abap web dynpro (e.g. through pressing an button). This event should be handled in flex. Does anyone know how to do this?
    Thank you and best regards, Eddy

    Hi Edger,
    You can have any trigger event on your WebDynpro Abap screen and then on that event you can call swf file from your mime folder or you can even update flex application data.
    for your help you can refer following tutorial which easily explaining all necessary steps nicely as per your required scenario:
    https://wiki.sdn.sap.com/wiki/display/EmTech/IslandsWDATutorial1
    If you are willing to trigger an event in flex then act in WDA that is also possible.
    Refer Bi-directional Data Binding and Eventing in following tutorial:
    https://wiki.sdn.sap.com/wiki/display/EmTech/IslandsWDATutorial2
    Regards,
    Vivek

  • Looking for an example VI that shows how to trigger an event in a VI from a subvi based on a value.

    I am looking for an example VI that uses a typical event structure for the GUI, but also has an event that will trigger based on a boolean value changing in a subVI to that VI.
    Thank you.

    You need to Create User Event.  Any Event structure which is registered with the event, whether it be in a subVI or otherwise can trigger the user event by using Generate User Event.
    Right-click an event structure and select Show Dynamic Event Terminal.  This is what you use to register your user (dynamic) events.
    Search for "events" in NI examples within LabVIEW.

  • How to Trigger the process chain using Excel Files?

    Hi All,
    We have 9 excel files(4 master data attributes and text files and 1 transaction file).
    Everyday new records will be added into the excel sheets and we need to trigger all these files into the bw server through process chain automatically . As we have all these Excel files in the desktop.
    Please suggest how to achieve this task?
    Thanks
    Gowtham

    Hi,
    You cannot load flat files to BW automatically using process chains.
    You have to upload them to Apllication server and point your Infopackage to the directory path of the flat file in application server. then process chains can load it.
    How to guide for loading flat file to application server.
    Program to load CSV file from local desktop to Application server(For flat file Data extraction)
    -Sriram

  • How to trigger an event web service when a mail received in Exchange Server ?

    Hi,
    I have a requirement of Triggering the event in Web-service with related data (Mail Details) whenever mail received in Exchange Server..
    I have done R&D on this, but I couldn't find answer.
    Is there any possibility of triggering the service ? If Yes, how can I achieve this?
    Thanks in Advance.

    Hi Jason,
    Using above link, I am getting notifications only for the logged in user
    service.Credentials = new NetworkCredential(EmailAddress,Password,domain);
    I want a way to get the notification or callback when a email comes from any user to the server. I tried as above , but i could get the notifications for a logged in user with his credentials.
    Please help me to find out a way to get the notifications from the server irrespective of the user login.

  • How to trigger an event every time BSID table is updated?

    Dear all,
    I have a request at my company to develop/implement/configure a trigger to BSID standard table, to catch all records inserted and perform some calculations with the field WRBTR. I must do this whenever a record is inserted.
    Thank you in advance, i hope you will understand my poor english.
    Kind Regards,
    /S. Nuvunga

    You need to do customization for the archivelink. In this you can also set the workflow which should be started. This isn't done using a change document or an event.
    Check the customizing, there are several nodes there you need to customize. Read the help in customizing for those steps. Check in customizing under:
    Application server --> Basic services --> Archivelink
    There are several nodes which need to be configured.
    Regards,
    Martin

Maybe you are looking for

  • How to get Windows 8.1 to show up under application requirements

    So I'm still using 2012 SP1, and I've added CU3 to the setup (at least I think I have). If anyone knows how to check for this let me know. Anyways, I'm able to deploy Windows 8.1 perfectly fine in my MDT task sequence with UDI, but I've ran into a hi

  • Using a Mac as a TV?

    Hey there everyone, I want to join the mac revolution. I also want a new TV... as I am not rich I thought to myself, can I use a Mac as a TV and connect it direct to my satellite box (via some sort of perihperal if necessary). The question is, do peo

  • Cannot open online pdf

    I "upgraded" to Firefox 4 today, and I'm now unable to open online pdf documents. They start to load (Acrobat appears, and I start to see a small portion of the document), and then the screen within that tab goes blank. This did not occur in the prev

  • Enable icfcommon logging for ICF Connector ??

    I have a custom icf-connector and some of the logs are not showing up. In my code I used ODJ loggers and those work fine, but the out of the box icfcommon loggers are not working. Someone has used the same custom connector and was able to get the icf

  • Docking issues with applications

    Since I installed Mavericks, whenever my desktop goes to sleep or I switch between accounts, I'll find all my application windows docked to the menu bar.  Is there a setting I'm missing?  Is this a known issue?  Is there a shortcut key I'm not aware