Results 1 to 19 of 19
  1. #1
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default Generate an event to another java application

    I'm not an advanced user but this question is directed to advanced users

    I have an already created java application, which code i can't modify. My purpose is create another application which can control the first one.

    I mean, the first one have a button called RUN and an actionPerformed method associated to it. Then i have to do that this event is called from the other application whitout clicking this button in the first one.

    Im spanish so my english is no so good. Sorry!

  2. #2
    sanjeevtarar's Avatar
    sanjeevtarar is offline Senior Member
    Join Date
    Apr 2008
    Location
    Jaipur(India)
    Posts
    318
    Rep Power
    7

    Default

    Are you using a web application or else. Please give some more details about your question.




    sanjeev

  3. #3
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    No. The application that i'm trying to "control" is a .jar file, is not a web application, you can run it in your computer just having Java Virtual Machine and executing the .jar file.

    My purpose is to know if is possible to control one application already created from other application.
    If you need more details please tell me

  4. #4
    sanjeevtarar's Avatar
    sanjeevtarar is offline Senior Member
    Join Date
    Apr 2008
    Location
    Jaipur(India)
    Posts
    318
    Rep Power
    7

    Default

    Can you send that jar.. so that i can check what exactly it is.


    sanjeev

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Are you trying to execute a jar file from a button event? I think because of the jar you say that in the first post,

    I have an already created java application, which code i can't modify.
    Is that right. If not correct me.

  6. #6
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    No, Eranga.
    I need to execute a button of an application from another different application. It means, i need to generate the onClick button event from my application to annother one.

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    What you mean generate onClick button event? I'm not clear what you say here pal.

    Again, did you want to generate a onClick button event on a application by another application?

  8. #8
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    Yes. I want to generate an event to one application from another one.
    The first application has a Botton which has associated an actionPerformed event. I'll need to call this event from the other application.
    I think it must be possible but i don't know how!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!
    HELP!!!

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  10. #10
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    I'm working with jBuilder.

  11. #11
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    but i can work with any other java IDE if it's better

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    No no, I'm not worried about your IDE. My question is that, when you create a actionPerformed method, what is the access modifier of it? I think it is private.


  13. #13
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    OK!
    The application that has the button is already created and i can't modify it. But i saw its code decompiling with an application called JAD.
    Then, it has a class named MyActionListener which catch all events and watches which is the event type.
    The code of this class is

    private class Osejs$MyActionListener
    implements ActionListener
    {

    public void actionPerformed(ActionEvent _evt)
    {
    String cmd = _evt.getActionCommand();
    if(cmd.equals("New"))
    {
    if(!isEmersionConnected() && isApplet)
    {
    Args[0] = cmd;
    if(htmlWindow != null)
    htmlWindow.call("ejsCommand", Args);
    }
    if(readOnly)
    {
    JOptionPane.showMessageDialog(Osejs.access$500(Ose js.this), Osejs.access$600().getString("Osejs.ReadOnly.Messa ge"), Osejs.access$600().getString("Osejs.ReadOnly.Title "), 1);
    return;



    and continuous. So, i need from the other application, to generete an event that this class can capture and treat it

  14. #14
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    If i don't explain right in english please tell me and i'll try do it better

  15. #15
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Ok, Here what happened is, that ActionLitener deals with the ActionEvent. As you can see in the above code it's get the action command, that is the text of your control. So try to do the same thing on the other class and check it on this class. If you pass the test, simply call the correct functions. I don't think you can generate the code there.

  16. #16
    i_berbeu is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default

    you say that

    So try to do the same thing on the other class and check it on this class.

    But it implies to change the code of the program. And i can't do it. I only can create another program to controll it. You know what i mean????? Maybe is possible that i dont understand you too.

  17. #17
    danielstoner's Avatar
    danielstoner is offline Senior Member
    Join Date
    Apr 2008
    Location
    Canada
    Posts
    191
    Rep Power
    7

    Default

    You have to bypass the whole GUI code in the jar file. If you are lucky enough the classes that do the job when the button is clicked are public and have public interfaces. In that situation you can call them directly from your application and use the jar file as a library. If the API is not public you might still stand a chance by declaring your classes in the same packages as the classes you want to call. Hope this helps.
    Daniel @ [www.littletutorials.com]
    Language is froth on the surface of thought

  18. #18
    indula is offline Member
    Join Date
    May 2008
    Posts
    4
    Rep Power
    0

    Default

    yes. i am using web application. i want pagination in jsp.

  19. #19
    indula is offline Member
    Join Date
    May 2008
    Posts
    4
    Rep Power
    0

Similar Threads

  1. Replies: 3
    Last Post: 03-26-2009, 11:31 PM
  2. difference btwn java.awt.* and java.awt.event.*
    By ahdus in forum New To Java
    Replies: 5
    Last Post: 11-17-2007, 07:07 PM
  3. How to generate random number in java
    By fernando in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 08:32 PM
  4. How can I generate MsWord from java?
    By simon in forum Advanced Java
    Replies: 2
    Last Post: 08-01-2007, 05:40 PM
  5. Replies: 2
    Last Post: 07-04-2007, 06:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •