(RMI) How to let a remote object display itself on the client application?

Discussion in 'Java' started by Thomas Hawtin, Jul 28, 2006.

  1. Re: (RMI) How to let a remote object display itself on the clientapplication?

    Mike wrote:
    >
    > I'm quite new to RMI and I have a theoretical question on how a
    > specific problem is usually solved.
    > My need is to create a client application not only able to work with
    > remote objects (that implement a specific interface) but also to
    > display them locally on the screen.
    > What I want is to have the possibility to add new classes of object on
    > the server (impementing the same interface as above) and have the
    > client able to display them too without changing the client. The client
    > will then receive the objects from a Factory that will return back the
    > object of the proper type.
    >
    > My idea then, is that the object should be able to display itself, so
    > that the client application would only have to call something like
    > 'print(JPanel)' on the remote object.
    >
    > But how does this work? Can I pass to the server a JPanel as argument?
    > I don't think this will work.



    If you pass a JPanel over RMI, it'll get copied. If you paint on
    the copy, the original will not be updated.

    Probably the easiest solution is to paint on an image, and serialise
    that. Alternatively, you could create an implementation of Graphics that
    uses RMI to paint onto a client Graphics object.

    Alternatively, you could dynamically load classes onto the client, using
    URLClassLoader.newInstance.

    http://download.java.net/jdk6/docs/api/java/net/URLClassLoader.html#newInstance(java.net.URL[])

    Tom Hawtin
     
    Thomas Hawtin, Jul 28, 2006
    #1
    1. Advertising

  2. Thomas Hawtin

    Mike Guest

    Hello to all.

    I'm quite new to RMI and I have a theoretical question on how a
    specific problem is usually solved.
    My need is to create a client application not only able to work with
    remote objects (that implement a specific interface) but also to
    display them locally on the screen.
    What I want is to have the possibility to add new classes of object on
    the server (impementing the same interface as above) and have the
    client able to display them too without changing the client. The client
    will then receive the objects from a Factory that will return back the
    object of the proper type.

    My idea then, is that the object should be able to display itself, so
    that the client application would only have to call something like
    'print(JPanel)' on the remote object.

    But how does this work? Can I pass to the server a JPanel as argument?
    I don't think this will work.

    How is this problem solved? Is there a pattern for this kind of
    situation?

    Thank you.
    Michele
     
    Mike, Jul 28, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. iksrazal
    Replies:
    0
    Views:
    428
    iksrazal
    Aug 27, 2003
  2. Vitali
    Replies:
    0
    Views:
    370
    Vitali
    Jul 6, 2004
  3. Buu Nguyen

    RMI, JINI or RMI/IIOP

    Buu Nguyen, Aug 25, 2004, in forum: Java
    Replies:
    1
    Views:
    601
    Sudsy
    Aug 25, 2004
  4. Luigi Donatello Asero

    Let or not let the text float

    Luigi Donatello Asero, Jan 15, 2004, in forum: HTML
    Replies:
    6
    Views:
    495
    Steve R.
    Jan 15, 2004
  5. Screamin Lord Byron
    Replies:
    14
    Views:
    577
    Screamin Lord Byron
    Jul 26, 2010
Loading...

Share This Page