Event binding (Programmed Binding (Container IF))

Hello WF gurus !
I am currenlty trying to trace and debug a WF run and I am having difficulty to understand the binding mechanism of a "Wait for event" step in my workflow.  Here is the story:  Through its execution run, the WF encountered two "Wait for event" step based on the same BOR-Event (ex: BOR = ZISPROCES1 - Event = ABANDON ).  The first occurence is directly is the WF (we will call this WF: WF1) and the 2nd occurence is in a sub-workflow (WF2).  The 2 work items for those 2 "wait for events" steps were created in March 2010, obviously waiting for the same event to occur.  The ABANDON event occured in June 2010 trigerring the execution of both work items waiting for this event.
When I look at the binding configuration of these "Wait for event" step (Popup screen: Display Binding From Event), I see the following:
- Under "Workflow" column: Programmed Binding (Container IF)
- Under "Event 'ABANDON' column: ZCONTAINER_BINDING_MAIL_ISIS
When I click on the "Programmed Binding (Container IF)" buton, i get a popup screen titled: "Binding Instruction Display" with the following config:
> Binding Instruction: Container --> Container: Programmed Binding (Container IF)
> Exit Function Module: ZCONTAINER_BINDING_MAIL_ISIS
When I look ath the FM ZCONTAINER_BINDING_MAIL_ISIS, I see that it uses three (3) import parameters:
DATAFLOW_EVENT   TYPE SWA_DAFLOW
SOURCE_CONTAINER TYPE SWFPARACNT
TARGET_CONTAINER TYPE SWFPARACNT
Assumption: Currently, from what I understand, the "Wait for event" step adds an object called "DELETOR" in the container of the workflow it belongs meaning that when the event will occur, the work item associated to these "Wait for event" steps will process and I should expect to have an object called "DELETOR" in the conainer of WF1 and WF2.
The problem: When I look at my WF log using TCode SWI6, and I look at the container data for each step following the "Wait for event" step (SEND MAIL step), I notice that the WF1's "Send Mail" step container contains an instance of the object called "DELETOR" with data in it.  WF2's "Send MaiL" step also contains an object called "DELETOR" but with mention <No Instance> and I don't understand why...
QUESTIONS:
- Where can I see what are the values passed to the FM import parameters ?
- Does anyone have an idea why in WF1's container, object "DELETOR" is instanciated and holds values and in WF2's container, there is an object "DELETOR" but is not instanciated.
Edited by: PAQUEJO on Dec 2, 2010 10:04 PM

Here is the code of FM ZCONTAINER_BINDING_MAIL_ISIS
FUNCTION zcontainer_binding_mail_isis.
*"*"Interface locale :
*"  IMPORTING
*"     VALUE(DATAFLOW_EVENT) TYPE  SWA_DAFLOW
*"     VALUE(SOURCE_CONTAINER) TYPE  SWFPARACNT
*"     VALUE(TARGET_CONTAINER) TYPE  SWFPARACNT
*"  EXCEPTIONS
*"      BINDING_ERROR
  INCLUDE <cntn01>.     " macros for accessing BOR objects and container
  INCLUDE <swfcntn01>.  " macros for accessing the new ABAP-OO-container
  TYPE-POOLS: swfbn.
  DATA: my_integer    TYPE        i.
  DATA: lcx_container TYPE REF TO cx_swf_cnt_container,
        l_msg         TYPE        swf_t100ms.
  DATA : l_creator(14).
  DATA : lo_usr01 TYPE swf_bor_object,
         lo_zis   type swf_bor_object.
  IF dataflow_event = swfbn_dataflow_export. " 'E'
**** 'EXPORT' point of time. This could be:
**** - workflow container to workitem container (before method call)
**** - event container to workflow container (event receive or wf start)
**** - workflow container to role container (before role resolution)
**** always move data from source to target container
    TRY.
        CALL METHOD source_container->get
          EXPORTING
            name  = '_EVT_CREATOR'                          "#EC NOTEXT
          IMPORTING
            value = l_creator.
*        ADD 17 TO my_integer.
        swf_create_object lo_usr01 'USR01' l_creator+2.
        CALL METHOD target_container->set
          EXPORTING
            name  = 'DELETOR'                               "#EC NOTEXT
            value = lo_usr01.
      CATCH cx_swf_cnt_container INTO lcx_container.
        l_msg = lcx_container->t100_msg.
        MESSAGE ID l_msg-msgid TYPE l_msg-msgty NUMBER l_msg-msgno
                WITH l_msg-msgv1 l_msg-msgv2 l_msg-msgv3 l_msg-msgv4
          RAISING binding_error.
    ENDTRY.
  ELSEIF dataflow_event = swfbn_dataflow_import. " 'I'
**** 'IMPORT' point of time. This could be:
**** - from workitem container to workflow container (after method exec)
**** - from workflow container to event container to (raise event)
**** always move data from source to target container
    TRY.
        CALL METHOD source_container->get
          EXPORTING
            name  = '_EVT_CREATOR'                          "#EC NOTEXT
          IMPORTING
            value = l_creator.
*        ADD 17 TO my_integer.
        swf_create_object lo_usr01 'USR01' l_creator+2.
        CALL METHOD target_container->set
          EXPORTING
            name  = 'DELETOR'                               "#EC NOTEXT
            value = lo_usr01.
        CALL METHOD source_container->get
          EXPORTING
            name  = '_EVT_OBJECT'                          "#EC NOTEXT
          IMPORTING
            value = lo_zis.
        CALL METHOD target_container->set
          EXPORTING
            name  = '_WI_OBJECT_ID'                               "#EC NOTEXT
            value = lo_zis.
      CATCH cx_swf_cnt_container INTO lcx_container.
        l_msg = lcx_container->t100_msg.
        MESSAGE ID l_msg-msgid TYPE l_msg-msgty NUMBER l_msg-msgno
                WITH l_msg-msgv1 l_msg-msgv2 l_msg-msgv3 l_msg-msgv4
          RAISING binding_error.
    ENDTRY.
  ENDIF.
ENDFUNCTION.

Similar Messages

  • Programmed Binding (Container IF)

    Hello Everyone,
    I was experimenting on Programmed Binding (Container IF) but I can't seem to make it work. I have had tried to refer the codes from the Programmed Binding (BOR Container) but to no avail.
    Is there anyone who can guide me on this?

    hi Liew
    You can use programmed binding in a binding instruction. You can use programmed binding to create more complex assignments, such as:
    ·        Perform calculations or checks on container elements before assignment
    ·        Combine two or more container elements before assignment
    You can implement a programmed binding as an ABAP class or a function module
    You can use an ABAP class to implement the Container ® Container and Expression ® Expression bindings.
    A binding that is implemented as an ABAP class is displayed in the list of binding statements as an enhancement and is visible in all Workflows. This type of ABAP class is therefore particularly suitable for making company-wide enhancements.
    An enhancement such as this is completely integrated in the binding editor. You can implement you own checks for the class and choose the names and symbols to be used to display the enhancement in the binding editor.
    Function module
    You can use a function module to implement the Container ® Container binding.
    A function module can use the BOR container interface or the container interface
    The BOR container interface supports compatibility reasons. It is therefore advisable to use the container interface for new function modules for the following reasons:
    ·         The container interface has no restrictions with regard to data types. The BOR container does not support the following data types: REF TO, STRING, XSTRING, fields that are longer than 255 characters.
    ·         No data type conversions are required for the container interface. This improves performance.
    for more info please go through the following link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/7c/b82bcd7b9611d194b80000e82dec10/content.htm
    guess it will surely help
    regards
    ashish

  • Programmed Binding (Container IF) - how to access source container data

    Hi,
    I have created a programmed binding (container IF) using a function module based on SWA_BINDING_TEMPLATE.
    I want to access an element (Meldung) based on BUS2078 (QM notification) from my source container and then retrieve the material from this element.
    When the element is a simple element such as WfInitiator for example I cant retrieve the value using the get method on the source container but when it is a complex element such as a BOR object it does not work. How can I retrieve such data.
    Thanks for your help,
    Emmanuel

    I finally found the answer last week, here is how I have done :
        DATA : l_matnr TYPE matnr.
        DATA : l_string TYPE string.
        DATA: lcx_container TYPE REF TO cx_swf_cnt_container.
        DATA: b_meldung TYPE swf_bor_object.
        TRY.
            CALL METHOD source_container->get
              EXPORTING
                name  = 'Meldung'
              IMPORTING
                value = b_meldung.
            swf_get_property b_meldung 'Material' l_matnr.
          CATCH cx_swf_cnt_elem_not_found .
            l_string = 'cx_swf_cnt_elem_not_found'.
          CATCH cx_swf_cnt_elem_type_conflict .
            l_string = 'cx_swf_cnt_elem_type_conflict'.
          CATCH cx_swf_cnt_unit_type_conflict .
            l_string = 'cx_swf_cnt_unit_type_conflict'.
          CATCH cx_swf_cnt_container INTO lcx_container.
            l_string = lcx_container->t100_msg.
        ENDTRY.
    Emmanuel

  • Error in Event Binding for Table UI element

    Hi,
    I had created a table UI element in my web dynpro component and it worked fine. After a few weeks, while I was making some other changes in the same module and did a syntax check on the component, I got this error "The event binding for element "TBL_ABC" contains errors". There is a "Correct errors" button given along with this error message, which removes the error. But I just wanted to know what is the reason for this error.
    Regards,
    Akshatha.

    Hi,
    Please check for the cardinality of the node which you are using to bind for the TABLE UI element.
    I think the cardinality should be either 1:N or 0:N.
    Give it a try.
    Regards,
    Lekha

  • Programmatic Contextual Events - binded components are null

    Dear ADF/Webcenter gurus,
    I am publishing and consuming a contextual event programatically in separate taskflows and managed beans.
    The wiring of consumer and publisher is established runtime via WebCenter composer (my taskflows are published as jar, but I think this does not regard the problem below).
    Problem is, in the consumer method of the bean, I cannot access any binded coponents.
    I suppose this is because when the bean receives the contextual event it doesn't know in which binding context the page is.
    For now, my solution is: create seperate bean for consuming the event, get the page bean by createValueExpression(#{beanName}); and call the desired beanName.method to go on.
    It works, but I want to be able to consume the event and acces binded components in the same bean.
    I have the same issue when programatically firing event (binded components == null).
    Waiting your ideas, Todor

    Thanks for the reply,
    I am currently using the 2nd mechanism for accessing the bean which contains the bindings of the page components (e.g panelTabbed).
    What I want is to do it in the same bean, without the need of resolving expressions (now I can resolve the expression ${beanName.panelTabbed}) - I think there should be a cleaner way.
    There's got to be a way to consume the contextual event in the same binding context!

  • CX Archive class file signature change is not reflected in event binding

    I have a CX archive file (.jar). I added a method to one of the class files in it and reuploaded to the archive. But, when I create a CX rule and specify event binding, this new method is not visible in the available list. What could be the cause of this issue and what is the resolution. Thanks.

    Its the way configurator works.
    First it checks in the middeltier java classpath if the class exists and if not, then look into archive to find the class.
    Archive has advantage like if you change the jar, you dont need to bounce the instance (need bounce for changing file on MT).
    Many developer will not have access to put the file on middle-tier, they can easily upload on archive.
    Archive will get moved automatically to target when you publish the model (MT file migration has to be done manually to publication target)

  • Binding containe gets reset on button click ?

    Hi All
    In my page i am calling a method of AMIMpl class :
        public void refreshEmpTable(){
          String pRefresh = "Y";
          requeryViewObjectWithBindVariable(getEmp(), "bRefresh", pRefresh);
    and
        private void requeryViewObjectWithBindVariable(ViewObjectImpl pViewObjectImpl,
                                                       String pVariableName,
                                                       String pVariableValue) {
            ViewObjectImpl vo = pViewObjectImpl;
            vo.setNamedWhereClauseParam(pVariableName, pVariableValue);
            vo.executeQuery();
        }And i can see the following log
    <DebugDiagnostic> <print> [12497] DBG: afterActionPerformed :refreshEmpTable
    <ADFLogger> <begin> Refreshing binding container
    <DCBindingContainer> <internalRefreshControl> [12498] **** refreshControl() for BindingContainer :com_xyz_abc_ui_flow_om_omf_omf_prepareSessionSessionPageDef_WEB_INF_com_xyz_abc_ui_flow_om_om_xml_omf
    prepareSession() - default method of the taskFlow
    The button that triggers the refreshEmpTable() of impl class has partial submit as true. What i can see here is it is resetting the task flow. Can some some give a clue as to what i have done wrong here.
    thnks,
    JDev 11.1.1.4
    Edited by: in the line of fire on Jun 22, 2011 5:03 PM
    Edited by: in the line of fire on Jun 23, 2011 11:52 AM

    <ViewObject xmlns="http://xmlns.oracle.com/bc4j" Name="DeptView" Version="11.1.1.59.23" AutoRefresh="true"
    set this value to false if its there... in any of your VO

  • Do I need to cleanup runtime binding container and iterators?

    If I create a runtime binding container and iterator in a JSF session bean as follows:
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ValueBinding valueBinding = facesContext.getApplication().createValueBinding("#{data}");
    BindingContext bindingContext = (BindingContext)valueBinding.getValue(facesContext);
    // To create JUIteratorBinding, we need the following objects
    DCDataControl dataControl = bindingContext.findDataControl("MyDataControlName");
    ApplicationModule appModule = (ApplicationModule)dataControl.getDataProvider();
    DCBindingContainer bindingContainer = new DCBindingContainer();
    // Create dynamic iterator.  Need to set bindingContainer otherwise executeQuery throws exception
    JUIteratorBinding iterator = new JUIteratorBinding(bindingContext, dataControlName, "MyViewObjectName", "MyIteratorName", -1);
    iterator.setBindingContainer(bindingContainer);....do I have to later clean down the iterator and binding container from the data control to release the memory (and what calls do I need to make), or once the objects fall out of scope in my code are they marked for GC?
    CM.
    PS. JDev 10.1.3.1, ADF BC and JSF

    Hi Steve, thanks for the follow up.
    I'm coding a dynamic menu <af:page> control that maps to the MenuTreeModelAdapter (session bean) as detailed in the JDev 4GL/Forms guide.
    I've made a change that instead of loading the menu items from the hardcoded faces-config.xml file, they're actually sourced from the database via the code above, which is placed in the MenuTreeModelAdapter constructor. As the <af:page> tag exists on a number of pages, and thus the MenuTreeModelAdapter may be instantiated for the first time from a number of different locations, I can't hard-code the binding container or iterator into any single pageDef file. Thus I dynamically construct it in the constructor when the session bean is created for each user. I require a session bean as the menu items are different for each user.
    However I'm concerned once I've created the binding container and iterator, that even though the session bean may become invalidated, the 2 binding layer constructs may remain, consuming resources.
    Thanks for your assistance.
    CM.

  • About binding container

    Hi
    I am using jdev 11.1.1.5.0
    I created a fragment page and bounded task flow.
    which have few bindings
    I drop the task flow as region on a jspx page.
    On the flow I drop a method call and define that method in backing of fragment.
    Now I define some functionality in that method to perform some task before page load
    I am using binding container in that method but it returns null .
    there is any solution to solve this problem...?
    Thanks.

    You need to create a pageDef/bindings file for that method call, and then the associated bindings you want to manipulate. To create the pageDef file right click on the method call and select the Create Page Definitions option.
    CM.

  • Binding container lifespan

    Can someone explain or point me to a decent description of the lifecycle of the ADFm binding container?
    For example, if I have variables defined within the "variables" variableIterator of a pageDef when do these get initialized and destroyed?
    Is there similarity to one of the memory scopes (request for example)?

    Hi,
    its by request. However, if you load the page then the variable iterator is filled with values during the init context phase, which is after retsore view. So the variable iterator should not be empty if it uses EL to access its values
    Frank
    Edited by: Frank Nimphius on Jan 7, 2010 4:24 PM

  • BackingBean Method call from Task flow isnot getting  the Binding Container

    Hi All,
    I am trying to call a backing bean method from a task flow using method call activity, where my page belongs to.
    In this method I am trying to get the binding container,
          DCBindingContainer dcbindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
          OperationBinding operationCreate = dcbindings.getOperationBinding("CreateInsert"); but it is evaluating to null and throwing null pointer exception.
    javax.el.ELException: java.lang.NullPointerException
         at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
         at oracle.adf.controller.internal.util.ELInterfaceImpl.invokeMethod(ELInterfaceImpl.java:168)
         at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:161)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:989)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:878)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:777)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:551)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:147)
         at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:109)
         at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:78)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)I guess, I miss something in this process, but no idea what it is ...!!!!
    Any help will be appreciated.
    I am using Studio Edition Version 11.1.1.3.0
    Ranjith

    Hi Arun,
    In my task flow i am calling a jspx page as a popup,
    through my jspx page I can do all these operations,
    but the problem is when I am trying to call a method written in the Backing bean of that page, at that time only the method is not getting the bindings.
    Create insert operation is there in the bindings....
    Ranjith

  • How to get an external binding container

    Hi friends.
    I'm migrating now to jdeveloper 11g
    Can anybody tell me how to get a reference to an external binding container. i found the decision:
         FacesContext fctx = FacesContext.getCurrentInstance();
                     ELContext elc = fctx.getELContext();
                     ValueExpression vle = fctx.getApplication().getExpressionFactory().createValueExpression(elc,"#{bindings}",DCBindingContainer.class);
                     DCBindingContainer bc = (DCBindingContainer)vle.getValue(elc);
                     if (bc == null) {
                         return;
                     BindingContext ctx = bc.getBindingContext();
                     DCBindingContainer dcb = ctx.findBindingContainer("jurDialogPageDef"); but it never works!!!!
    bc is always null.
    neither simplier the approach works
            BindingContext _ctx=BindingContext.getCurrent();
            DCBindingContainer dcb = (DCBindingContainer)_ctx.findBindingContainer("jurDialogPageDef");           
            DCIteratorBinding jurIter = (DCIteratorBinding) dcb.get ("JurPersonView1Iterator"); dcb is null though the jurDialogPageDef.xml does exist.
    Thanks in advance. Alex.

    Hi,
    I hope my previous post below will be helpful:
    Re: Execute query's from a bean
    Regards,
    Pino

  • Error because of wrong page definition/binding container

    Hello -
    (Using JDev 10.1.3 JSF w/ADF BC)
    I'm running into a weird "issue" involving setting up the binding container.
    I have one page that has a table of data. I select a row and hit a button to navigate to a page with an edit form.
    In the page definition (for the page with the edit form), I list a managed bean as the ControllerClass. (I use the bean as a PagePhaseListener.) I've also added bindings (#{bindings}) as a managed property for that bean.
    In the managed bean I grab a hold of an attribute binding from the binding container in my beforePhase method (when the phase id is Lifecycle.PREPARE_RENDER_ID). However, I was always getting NULL for the attribute binding (which then caused a null pointer exception).
    When I paused the execution in the debugger, it looks like the binding container was still set up for the previous page (the page with the table in it). Opening up the bindings variable, I found a member mBindingContainerDef which had members mObjName and mFullName which seemed to indicate that the binding container was the one for the previous page, NOT the page with my edit form. (mFullName had the full name and classpath for the first page's page definition.)
    Why is this? I only indicate that the bean is a ControllerClass in the page definition for the 2nd page --> so shouldn't that be the binding container in effect when the PagePhaseListener methods are executed?
    -- Scott

    Scott,
    I assume that your PhaseListener doesn'tdistinguish between the actual navigation and the JSF postback that is issued to the same page. In your case I assume that the PhaseListener is invoked on postback and thus ADF Faces points to the "old pagedef" file.
    Frank

  • Event-Driven Programming

    Hello Everyone,
    I am new to this forum and also new to event-driven programming. Anyways, I am doing a small exercise to get myself familiar with event-driven programming. In particular, the program responds to keys entered on a keyboard. The exercise in a way resembles how a second hand moves in a clock. So, here's what I am trying to do. Originally the hand points at 12 o'clock. when I press the right arrow key the hand should move 6 degrees to the right and when I press the left arrow key the hand should move 6 degrees to the left. The code I have so far seems fairly correct to me but when I run the program and press the arrow keys on my keyboard nothing happens. Any help would be appreciated and thank you in advance.
    Here is my code:
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class hittingBalloons extends JFrame{
         hittingBalloons(){
              mouseKeyboardListeners p = new mouseKeyboardListeners();
              add(p);
              p.setFocusable(true);
         public static void main(String[] args){
              hittingBalloons frame = new hittingBalloons();
              frame.setTitle("Hitting Balloons");
              frame.setSize(500,500);
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);
         public class mouseKeyboardListeners extends JPanel{
              private int xCenter=250;
              private int yCenter=250;
              private int xEnd =250;
              private int yEnd =210;
              private int angle=0;
              private int gunLength=40;
              private int xBall = 150;
              private int yBall = 150;
              private int radius = 20;
              public mouseKeyboardListeners(){
                   addKeyListener(new KeyAdapter(){
                        public void keyPressed(KeyEvent e){
                             if(e.getKeyCode() == KeyEvent.VK_LEFT){
                                  angle = (int)(angle - (Math.PI/30));
                                  xEnd = (int)(xCenter + gunLength*Math.sin(angle));
                                  yEnd = (int)(yCenter - gunLength*Math.cos(angle));
                                  repaint();
                             else if (e.getKeyCode() == KeyEvent.VK_RIGHT){
                                  angle = (int)(angle + (Math.PI/30));
                                  xEnd = (int)(xCenter + gunLength*Math.sin(angle));
                                  yEnd = (int)(yCenter - gunLength*Math.cos(angle));
                                  repaint();
              protected void paintComponent(Graphics g){
                   super.paintComponent(g);
                   g.drawLine(xCenter,yCenter,xEnd,yEnd);
    }

    A few notes and suggestions:
    1) Welcome to the forum!
    2) When posting code, please use code tags as it makes your code easier to read. the FAQ will show you how. e.g.,
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class hittingBalloons extends JFrame{
         hittingBalloons(){
              mouseKeyboardListeners p = new mouseKeyboardListeners();
              add(p);
              p.setFocusable(true);
         public static void main(String[] args){
              hittingBalloons frame = new hittingBalloons();
              frame.setTitle("Hitting Balloons");
              frame.setSize(500,500);
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);
         public class mouseKeyboardListeners extends JPanel{
              private int xCenter=250;
              private int yCenter=250;
              private int xEnd =250;
              private int yEnd =210;
              private int angle=0;
              private int gunLength=40;
              private int xBall = 150;
              private int yBall = 150;
              private int radius = 20;
              public  mouseKeyboardListeners(){
                   addKeyListener(new KeyAdapter(){
                        public void keyPressed(KeyEvent e){
                             if(e.getKeyCode() == KeyEvent.VK_LEFT){
                                  angle = (int)(angle - (Math.PI/30));
                                  xEnd = (int)(xCenter + gunLength*Math.sin(angle));
                                  yEnd = (int)(yCenter - gunLength*Math.cos(angle));
                                  repaint();
                             else if (e.getKeyCode() == KeyEvent.VK_RIGHT){
                                  angle = (int)(angle + (Math.PI/30));
                                  xEnd = (int)(xCenter + gunLength*Math.sin(angle));
                                  yEnd = (int)(yCenter - gunLength*Math.cos(angle));
                                  repaint();
              protected void paintComponent(Graphics g){
                   super.paintComponent(g);
                   g.drawLine(xCenter,yCenter,xEnd,yEnd);
    }3) For key listeners to work, the component must have the focus, and JPanels don't get focus by default. You have to call setFocusable(true) first and then request focus in window on the JPanel.
    4) Even better would be to use key binding, and to learn to use these, check out the Sun tutorial.
    Luck and again, welcome!

  • Periodic reading data with event driven programming

    Hi all
    I want to read data from a device periodically, for example every 2 seconds.
    but I want to use event driven programming in order to response user events.
    now I don't know how to do this......!!
    maybe I should use timed loop or timed sequence structure
    if I use this structures, should I use then inside the while loop or outside the while loop( I mean the while loop that contains the event cases)?
    please help me and accept my thanks....

    You ned to run these in two separate loops. Look at the Producer/Consumer template. Put a two second time-out on the Dequeue Element and you have a loop that will run every two seconds. The loop should also handle information from the event structure.
    Separate loops is the best way of handling this.
    Rob

Maybe you are looking for

  • API - BAPI , RFC Function module to validate user id and password

    Hi, Can anyone provide me with the function module to validate the username and password of the user of the back end R/3 System. Best Regards Sid

  • Workflow - Notification to a Position in Org Unit

    Hi, I have a requirement to Send a Notification to an authorized person in the ORG Unit.This Task is a background task which uses the BO SELFITEM and Method SENDTASKDESCRIPTION. I can send the notification by passing a value thru address strings.How

  • Cannot play Flash content in IE7

    When I navigate IE7 to any site (including adobe.com) that has Flash content, I get a message saying I need to enable javascript (it is) and/or upgrade my Flash player. I am running Vista, and this worked until sometime in the last week or so. Flash

  • NavFunPro for Nokia 6500 classic

    Hi, I bought this program for my fone which is fully internet setup, but when i try to connect when first starting it up it simply gets stuck at the 'connecting...' screen. as far as i can tell my settings are correct and i've been thru the faqs as m

  • Jrockit 3.0.0-1.5.0 on Solaris 9 - coredump when executing java -version

    Hi, I installed jrrt-3.0.0-1.5.0 on a Solaris 9 virtual machine. When I set JAVA_HOME and PATH to point to the jrockit install and then execute java -version, I get a Segmentation Fault. Any idea why this would be happening? I don't see a core dump f