How to execute a method on mouse move event on an Image

Hi All,
I want to execute a method on mouse move event or mouse click event to an image.
how can i achieve this?
TIA,
Vishal

I am not sure if commandImageLink or goImageLink solve your requirement.
But as a workaround you can use set of ClientListener and ServerListener with af:image to achieve what you need.
using then you can capture client event and convert that into server event which you can use to call a bean method.
Inside this bean you can call a web service or method binding.
My first link in previous post shows that very well....
OR
http://naive-amseth.blogspot.com/2011/02/calling-methodbindingwebservice-on.html
Amit
Edited by: amseth on Feb 15, 2011 12:25 AM

Similar Messages

  • How to execute the method of a class loaded

    Hi,
    I have to execute the method of com.common.helper.EANCRatingHelper" + version
    version may be 1,2, etc
    if version = 1 the class is com.common.helper.EANCRatingHelper1;
    Iam able to load the class using following code.But iam unable to execute the method of the above class
    Can anybody help me how to execute the method of the class loaded.
    Following is the code
    String version = getHelperClassVersion(requestDate);
    String helperClass = "com.redroller.common.carriers.eanc.helper.EANCRatingHelper" + version;
    Class eancRatingHelper = Class.forName(helperClass);
    eancRatingHelper.newInstance();
    eancRatingHelper.saveRating(); This is not executing throwing an error no method.
    Thanks

    eancRatingHelper.newInstance();Ok, that creates an instance, but you just threw it away. You need to save the return of that.
    Object helper = eancRatingHelper.newInstance();
    eancRatingHelper.saveRating(); This is not executing throwing an error no method.Of course. eancRatingHelper is a Class object, not an instance of your EANCRatingHelper object. The "helper" object I created above is (though it is only of type "Object" right now) -- you have to cast it to the desired class, and then call the method on that.
    Hopefully EANCRatingHelper1 and 2 share a common interface, or you're up the creek.

  • How to execute a method after page Load?

    My question is very similar to what was discussed in following thread:
    How to execute a method after page Load?
    My requirement is that I want to run a method in backing bean of a page, immediately after the page gets loaded. In that method I want to invoke one of the method action included in the pagedef of this page, conditionally.
    I tried using the approach given in the above thread, i.e to use <f:view afterPhase="#{backing_security.setPermPriv}">, but the problem is that our page is not using 'f:view' , so I explicitly added one f:view with afterPhase property set , but it is not working, page it self is not getting loaded, it is throwing the error:
    Root cause of ServletException.
    java.lang.IllegalStateException: <f:view> was not present on this page; tag [email protected]e8encountered without an <f:view> being processed.
         at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.setProperties(UIXComponentELTag.java:108)
         at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:733)
         at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1354)
         at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:71)
         at oracle.adfinternal.view.faces.taglib.UIXQueryTag.doStartTag(UIXQueryTag.java:41)
         at oracle.adfinternal.view.faces.unified.taglib.UnifiedQueryTag.doStartTag(UnifiedQueryTag.java:51)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:262)
         at oracle.jsp.runtime.tree.OracleJspNode.execute(OracleJspNode.java:89)
         at oracle.jsp.runtimev2.ShortCutServlet._jspService(ShortCutServlet.java:89)
         at oracle.jsp.runtime.OracleJspBase.service(OracleJspBase.java:29)
         at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:665)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:387)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:822)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:746)
    Please help to resolve this issue, or am I doing anything wrong?

    Hi,
    I assume that your view is a page fragment and here - indeed - the f:view tag cannot be used. If you use ADF then one option would be to use a custom RegionController on the binding layer to listen for the render phase to invoke the method. Another option would be to use a hidden field (output text set to display="false" and have this component value referencing a managed bean property. The managed bean property's getter method can now be used to invoke the method you want to run upon view rendering
    Frank

  • How to calculate total time of mouse movement

    Hi Everyone.
    I am doing project on gesture recognition with touchpad. I need to find out the total time of completion of gesture on touchpad. For that I need to calculate total time of cursor movement on laptop touchpad. When cursor starts moving, that time I need to capture time and when it stops also. I need to find out difference between the start time and stop time. Please help me to do this task. Presently I am trying with event structure and timed structure but I am getting only present time only. I tried with counter but unable to get the difference.

    I missed the mouse move event when I saw this earlier, and for some reason I thought the first attempt would give you what you wanted. 
    Here is a different VI. It uses mouse move event with some logic that remembers the first mouse move event. Otherwise, you won't get the correct time.
    Attachments:
    Mouse Move Time.vi ‏11 KB

  • Dynamically register "mouse move" event for a VI

    Just as in the example ”Dynamically Register for Events.vi” I want to dynamically register a “Mouse Move” event. I use the “Open VI Reference” to get the reference to the VI and I connect it to the “Register For Events” block just as in the example. When I click the block I get a list of events to choose from, but the “mouse move” event is not one of them. How do I select this event?
    I have got the program running by copying the “Register For Events” block from the example and into my program, but I’m interested to know how this should have been done.
    I use LabView 8.0

    I've had the same problem in LV 8.2.1 and 8.5. I found that NI changed how to access the mouse move... it's now available under "Pane." See my attached example, a modified NI Example.
    Derek
    Attachments:
    Dynamically Register for Events - 8X.vi ‏44 KB

  • Mouse move event when mouse out of stage.

    Hi
      I'm wondering how is this task done that listen to mouse move event when user cursor is out of stage?

    Hi, kennethkawamoto2
        I've tried in this way: use "stage.mouseX, stage.mouseY" these two values when cursor is out of stage, and it worked quite well till now,
    If you mind discribe the issue that you've metion that " Flash does not report mouse location correctly beyond stage.." more in detail, I think I should avoid this. Thank you very much!

  • XY graph "mouse move" event stops generating when click on cursor

    Hello All
    When the mouse is moving freelly inside the XY graph control, the "mouse movement" event is fired.
    The same happens when muse clicks anywhere in the graph with the exception of cursors.
    hen mouse clicks on cursors the "mouse move" event is NOT generated even though the mouse is phisically moved.
    Is there any explanation to this.
    I enclose the example.
    regards
    Pawel

    Just today I had the same problem -> my solution:
    set event timeOut to some value(I have it at 1ms) then
    add to globalVariables some BOOL variable that will signal if mouse is down or up (set the flag in appropriate event),
    then add a case in the timeOut event which will read this
    global variable(flag) -> if it's TRUE then change the needed parameter.
    So even if the mouse move event isn't fired the main timeout event is.
    Not a perfect solution, but better than nothing.
    Peace
    Waldemar

  • Image control mouse move event updates

    I would like to drag the ROI around in the Image control (holding down the left mouse button) and continually read out the ROI coordinates. I can't find a way to do this: the mouse move event does not seem to fire if I hold the left mouse button down. I assumed that I would have
    1. Mouse down when I click and hold.
    2. Mouse move when I move the ROI around.
    3. Mouse up when I release the left mouse button.
    This does not seem to be the case.
    I've done a simple workaround which is
    1. Use the key up event to check that the space bar has been pressed.
    2. Use this to toggle a "lock" boolean which locks the target to the mouse coordinates.
    3. Use the mouse move event to return the Image Control Mouse Coordinates property.
    4. Unlcok the target from the mouse coordinates by pressing the space bar again.
    This kind of works, but it is much less intuitive than the standard windows "click and drag".
    Any comments appreciated.
    Thanks.
    PS The Image Control is excellent, it has saved me lots of development time. Also, the ROI tools are hugely useful.

    If you filter the mouse down event (MOUSE DOWN?) then the coordinated are always returned on mouse move event weather the mouse is down or not.  I did get the coordinates when the left button was down anyway it was just when the right button was down which the move event was not handled (due to the popup menu consuming the event first?)  I thing there is a good way to do this with dynamic event registration, and NI has a similar example of drag and drop of controls, but I am not at my LV machine to look for it right now.  If I am wrong I am sorry it is early and my coffee is not brewed yet.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Mimicking mouse move event

    Hi,
    I'm using flex through a plugin, and not though a browser (like most people do). For some strange reason my flex SWF doesn't receives mouse move events. I can get the mouse move events in the application that contains the SWF, and I can tell the SWF that the events has occured, using the externalInterface API.
    Once I received a call that indicates a new mouse position, I want to mimick it as a normal mouse move event. Any ideas on a simple way to do this?
    thanks in advance,
    Vince

    If you have the stage coordinates of the mouse, you can get pretty far by calling getObjectsUnderPoint and dispatching a MouseEvent from the last element in the array (converting the stage coordinates to local).
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • How can I stop coalescing of mouse move/drag events in jdk1.6 ?

    Hello all,
    My application uses a [pen-based tablet|http://en.wikipedia.org/wiki/Graphics_tablet] to draw lines/curves. But the problem is: when I run my application, due to java’s default behavior of discarding the mouse events which occurs during the repaint call, the curves results in the set of joined straight lines.
    To overcome this problem, when searched over net, came across below link:
    [http://forums.sun.com/thread.jspa?messageID=10811388]
    I tried the option provided at the above URL i.e. overriding the below method of Component.java file:
    protected AWTEvent coalesceEvents(AWTEvent existingEvent,AWTEvent newEvent);
    But later found that, overriding this method worked fine for me for jdk1.5 but this solution did not work in case of jdk1.6. When reviewed the source of Component.java and EventQueue.java files in jdk1.6, found that this method is not having any implementation and simply returns “null” and the complete handling of coalescing of events occurs within EventQueue.java file’s local method which is mentioned below:
    private boolean coalesceEvent(AWTEvent e, int priority);
    As this method is part of EventQueue.java and also it is a private method, I am not finding any way to stop the coalescing of mouse move/drag events in jdk1.6.
    The main problem is that my application is purely based on jdk1.6 only.
    Can anybody help me out to solve this problem by providing any option of preventing the coalescing of mouse move/drag events in case of jdk1.6.
    Thank you.

    Look at the link I posted, you aren't double buffering correctly.
    I saw the other post you mistakenly made before you edited it. Not really a big deal, I was just wondering why you did that.

  • How to execute a method from String object?

    I have some methods in String objects, example:
    String methodOne = "someMethod1";
    String methodTwo = "someMethod2";
    public void someMethod1() {
    public void someMethod2() {
    How can i execute that methods, when the method names i have only in String objects?

    You can get the method directly from the name and parameter types if you want to avoid using the loop:public class Foo27 {
      public static void main (String[] args) throws Exception{
        String methodOne = "someMethod1";
        String methodTwo = "someMethod2";
        Object foo = new Foo27();
        Method method1 = foo.getClass().getMethod(methodOne, new Class[]{});
        method1.invoke(foo, null);
        Method method2 = foo.getClass().getMethod(methodTwo, null);
        method2.invoke(foo, null);
      public void someMethod1() {
        System.out.println("someMethod1");
      public void someMethod2() {
        System.out.println("someMethod2");
    }The parameter types are required as there could be more than one method with the same name.
    For somereason when I tried to create a new Method object and invoke it, an exception was thrownThere isn't a public constructor for Method, so how did you create a new one?
    Pete

  • How to execute applets method from jsp?

    Hi ,
    I have a query.I have a jsp page
    on loading the jsp page the applet should be
    loaded.And i have a button in my jsp page on clicking
    the button a method written in the applet class should
    be executed .How can i do this.Iam attaching the
    classes also.There r two java files.One is EXPosApplet.java and other is EXPos.java
    In the EXPosApplet.java i have a method called
    RunNotepad().This method should be executed when i click the
    button in my jsp page.Pls provide me with some code to load the applet and execute the method of applet.It is a bit urgent.
    Thanks
    Naveen
    The following is my
    EXPos.java class.Following this is my EXPosApplet.java class.
    EXPos.java
    package SumberPutra.External;
    import java.io.*;
    public class EXPos extends Object {
         * Constructor
         public EXPos() {
    private static void RunIt(String fileName){
         try {
         Runtime.getRuntime().exec(fileName);
              catch (SecurityException e) {
    System.out.println("ExecFile: caught security exception: " + e) ;
    catch (IOException ioe) {
    System.out.println("ExecFile: caught i/o exception: " + ioe);
    public void RunNotepad(){
         String fname = "notepad.exe";
    RunIt(fname);
    EXPosApplet.java
    package SumberPutra.External;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class EXPosApplet extends JApplet {
         boolean isStandalone = false;
         private EXPos expos = new EXPos();
         JButton jButton1 = new JButton();
         JLabel jLabel1 = new JLabel();
         * Constructs a new instance.
         * getParameter
         * @param key
         * @param def
         * @return java.lang.String
         public String getParameter(String key, String def) {
              if (isStandalone) {
                   return System.getProperty(key, def);
              if (getParameter(key) != null) {
                   return getParameter(key);
              return def;
         public EXPosApplet() {
         * Initializes the state of this instance.
         * init
         public void init() {
              try {
                   jbInit();
              catch (Exception e) {
                   e.printStackTrace();
         private void jbInit() throws Exception {
              this.setSize(new Dimension(400, 156));
              jButton1.setText("jButton1");
              jLabel1.setText("jLabel1");
              jButton1.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        jButton1_actionPerformed(e);
              this.getContentPane().add(jButton1, BorderLayout.NORTH);
              this.getContentPane().add(jLabel1, BorderLayout.SOUTH);
         * start
         public void start() {
         * stop
         public void stop() {
         * destroy
         public void destroy() {
         * getAppletInfo
         * @return java.lang.String
         public String getAppletInfo() {
              return "Applet Information";
         * getParameterInfo
         * @return java.lang.String[][]
         public String[][] getParameterInfo() {
              return null;
         static {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch(Exception e) {
                   e.printStackTrace();
    public void ExecNotepad(){
         expos.RunNotepad();
    /*     void jButton1_actionPerformed(ActionEvent e) {
    try
              Runtime.getRuntime().exec("notepad.exe");
              catch (SecurityException ex) {
    // strMsg = "ExecFile: caught security exception: " + e ;
    jLabel1.setText("ExecFile: caught security exception: " + ex) ;
    catch (IOException ioe) {
    // strMsg = "ExecFile: caught i/o exception: " + ioe;
    jLabel1.setText("ExecFile: caught i/o exception: " + ioe);

    Iam new to java .Can u please give me the code to load the applet and execute applets method
    Thankyou

  • How to execute Applet method from jsp?

    Hi ,
    I have a query.I have a jsp page
    on loading the jsp page the applet should be
    loaded.And i have a button in my jsp page on clicking
    the button a method written in the applet class should
    be executed .How can i do this.Iam attaching the
    classes also.There r two java files.One is EXPosApplet.java and other is EXPos.java
    In the EXPosApplet.java i have a method called
    RunNotepad().This method should be executed when i click the
    button in my jsp page.Pls provide me with some code to load the applet and execute the method of applet.It is a bit urgent.
    Thanks
    Naveen
    The following is my
    EXPos.java class.Following this is my EXPosApplet.java class.
    EXPos.java
    package SumberPutra.External;
    import java.io.*;
    public class EXPos extends Object {
    * Constructor
    public EXPos() {
    private static void RunIt(String fileName){
    try {
    Runtime.getRuntime().exec(fileName);
    catch (SecurityException e) {
    System.out.println("ExecFile: caught security exception: " + e) ;
    catch (IOException ioe) {
    System.out.println("ExecFile: caught i/o exception: " + ioe);
    public void RunNotepad(){
    String fname = "notepad.exe";
    RunIt(fname);
    EXPosApplet.java
    package SumberPutra.External;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class EXPosApplet extends JApplet {
    boolean isStandalone = false;
    private EXPos expos = new EXPos();
    JButton jButton1 = new JButton();
    JLabel jLabel1 = new JLabel();
    * Constructs a new instance.
    * getParameter
    * @param key
    * @param def
    * @return java.lang.String
    public String getParameter(String key, String def) {
    if (isStandalone) {
    return System.getProperty(key, def);
    if (getParameter(key) != null) {
    return getParameter(key);
    return def;
    public EXPosApplet() {
    * Initializes the state of this instance.
    * init
    public void init() {
    try {
    jbInit();
    catch (Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception {
    this.setSize(new Dimension(400, 156));
    jButton1.setText("jButton1");
    jLabel1.setText("jLabel1");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jButton1_actionPerformed(e);
    this.getContentPane().add(jButton1, BorderLayout.NORTH);
    this.getContentPane().add(jLabel1, BorderLayout.SOUTH);
    * start
    public void start() {
    * stop
    public void stop() {
    * destroy
    public void destroy() {
    * getAppletInfo
    * @return java.lang.String
    public String getAppletInfo() {
    return "Applet Information";
    * getParameterInfo
    * @return java.lang.String[][]
    public String[][] getParameterInfo() {
    return null;
    static {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch(Exception e) {
    e.printStackTrace();
    public void ExecNotepad(){
    expos.RunNotepad();
    /* void jButton1_actionPerformed(ActionEvent e) {
    try
    Runtime.getRuntime().exec("notepad.exe");
    catch (SecurityException ex) {
    // strMsg = "ExecFile: caught security exception: " + e ;
    jLabel1.setText("ExecFile: caught security exception: " + ex) ;
    catch (IOException ioe) {
    // strMsg = "ExecFile: caught i/o exception: " + ioe;
    jLabel1.setText("ExecFile: caught i/o exception: " + ioe);

    hie Naveen
    I don't have time to read your code.
    just telling you the way i did it.
    I used javascript for this
    apply onClick() event on button.
    function invokeApplet() {
    app = document.applets[0].methodName(param1,param2);
    hope this helps
    if you still face the problem
    I'll look in to your code

  • How to execute a method used in Model

    Hello Guys,
    I want to know that how to retrieve the data from the Model used in my webdynpro project.
    scenario
    - I have created CAF appliation with Customer BO and generated this BO as a service called findAllCustomer. This service is tested and working.
    - I have made a webdynpro project and created a Model by using WSDL link
    - I have then referenced the Model nodes to the context of the component controller
    - I have then generated a table by using template on view controller (list of customer)
    question: how do I invoke the the method to fill the table of customers??
    Regards,
    NK

    hello guys,
    Thanks for the reply.
    I have implemented the code what you guys have sent to me. I have implented this code on a Method of the component controller. Then I call that method on the button event of the view controller.
    when i press the button, I got the error message.
    Do you guys know where to set the authentication for this service?
    com.sap.esi.esp.lib.mm.config.exceptions.TechnicalException: Failed to create Logical Port for Service Reference with id [CustomerBO_new_undefined_sg_1_BASIC]. Reason for the failure is that no one of the following Authentication Methods [None], [SAP Logon Ticket], or [SAML Assertion] is allowed in the related Communication Profile. Such an Authentication Method is needed as the Authenticaton Profile is [businessOrTechnicalUser] and no User Account is assigned, so the Authenticaton Profile is considered to be noAuthentication or businessUser. Related Communication Profile is [SAP_DEFAULT_PROFILE 1] and it allows Authentication Method(s) [User Name/Password (Basic), X.509 Client Certificate, SAP Logon Ticket, SAML Assertion, X.509 Certificate Doc.Auth., User Name/Password Doc.Auth.]
        at com.sap.esi.esp.service.server.RuntimeConfigGeneratorImpl.createLogicalPortForServiceReference(RuntimeConfigGeneratorImpl.java:421)
        at com.sap.esi.esp.service.server.query.discovery.DestinationsHelperImplSoa.selectServiceEndpoint(DestinationsHelperImplSoa.java:1020)
        at com.sap.esi.esp.service.server.query.discovery.DestinationsHelperImplSoa.getWSDLUrl(DestinationsHelperImplSoa.java:996)
        at com.sap.engine.services.webservices.espbase.client.dynamic.GenericServiceFactory.getWSDLUrl(GenericServiceFactory.java:582)
        at com.sap.engine.services.webservices.espbase.client.dynamic.GenericServiceFactory.createService_NewInstance(GenericServiceFactory.java:338)
        ... 85 more
    Regards,
    Naeem

  • How to avoid built-up for "cursor move" events?

    I have a rather complicated program where several graphs need to be interactively updated according to cursors using "cursor move" events. The problem is that the recalculation is relatively slow and the behavior is less than satisfactory. Since the cursor position needs to be "tweaked" until the result is as desired, I cannot recalculate only at the "Cursor Release" event.
    Lock front panel=enabled makes cursor movements tedious because the cursor movements is very
    jumpy and non-interactive. Not user friendly!
    Lock front panel=disabled queues up way too many move events and once the cursor is released
    the graph continues to jump and recalculate for ages.
    The attached demo (LabVIEW 8.20) shows one solution attempt that actually works pretty well: Skip the recalculation unless the cursor position from the event terminal is equal to the cursor position of the graph property node. This basically races through all unecessary intermediary recalculations on stale positions. However, the code can get complicated very quickly if there are multiple cursors.
    In my opinion, cursor move events should not get queued up! The event buffer should hold only exactly one entry:
    the most recent cursor position for each cursor. Can anyone think of a scenario where the extra cursor position trail is useful? The positions are pretty random anyway, right?
    Does anyone have other (better!) ideas how to work around this problem? I definitely want to keep it simple and not throw lots of code at it.
    The attached demo contains more details. It demonstrates the problem if "selective updates" is checked. If unchecked, it implements the above mentioned workaround.
    LabVIEW Champion . Do more with less code and in less time .
    Solved!
    Go to Solution.
    Attachments:
    CursorDelay.vi ‏29 KB

    Thanks for the example.
    The more I think about this, I strongly prefer my original method. It uses minimal code compare to the other solutions offered here. As a demo, I am attaching an implementation to a slide control.
    Fo those without LabVIEW 8.20.
    All slide events have "lock front panel" disabled.
    TIme delay is 500ms, simulating some complex calculation.
    As you can see, it works extremely well:
    NO shift registers, extra loops, queues, tuning parameters (min times, etc.), etc.etc.
    Just a deceptively simple "equal" followed by a case structure.
    The demo shows a typical recording if I quicky move the slide up and down, then release it. You can see that the raw event structure takes more than 40 seconds to stabilize while my selective solution follows the slider position almost perfectly despite the 500ms stall in each update.
    See for yourself! Can anyone think of a drawback of this method? Even if the slide terminal is not in the same loop, a comparison of a local variable with the newval should do the trick just fine.
    Message Edited by altenbach on 09-28-2006 12:43 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SLIDEDelay.vi ‏26 KB
    SlideUpdate.png ‏21 KB

Maybe you are looking for