Results 1 to 4 of 4
  1. #1
    themburu is offline Member
    Join Date
    Mar 2008
    Posts
    20
    Rep Power
    0

    Default passing parameters to paint mtd

    I have placed several applets on my web page and I able to pass parameters among them the problem is one applet is drawing some lines, I want to pass parameters to the paint method so as it updates the drawn lines to the new cordinate points specified by the requesting applet, I mean it should be dynamic but as I understand paint is called after init so how do I manage to keep on redrawing the lines as per the parameters passed.
    The dream of being a legend has just begun!

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default

    Call the repaint() method when you want the jvm to call the paint() method.

    Put the parameters somewhere the paint() method can see them.
    Last edited by Norm; 06-27-2008 at 05:43 PM.

  3. #3
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Exclamation java.lang.Runnable

    Quote Originally Posted by Norm View Post
    Call the repaint() method when you want the jvm to call the paint() method....
    There are sysem issues that make contemporary practice to utilize: Invoke Later () the established practice. This allows the system to schedule the repaint and return to code provided by application. It is needful that calls to paint() be Idempotent and be scheduled by the JVM.

    To do as seems obvious in code results in sluggish display that sometimes hangs.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default

    I haven't seen that. Do you mean the instead of calling repaint() directly from your code, you should call repaint() inside of an invokeLater(...) method call?

Similar Threads

  1. passing parameters between two applets
    By veena1612 in forum Java Applets
    Replies: 1
    Last Post: 05-27-2008, 10:29 AM
  2. [SOLVED] Passing parameters in Eclipse
    By DonCash in forum Eclipse
    Replies: 2
    Last Post: 04-08-2008, 05:46 PM
  3. JNI - passing and returning parameters by value
    By java_to_c in forum New To Java
    Replies: 0
    Last Post: 01-31-2008, 09:49 PM
  4. Replies: 0
    Last Post: 11-10-2007, 05:47 PM
  5. paint() and paintComponent()
    By goldhouse in forum Java 2D
    Replies: 1
    Last Post: 07-17-2007, 04:43 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
  •