Results 1 to 8 of 8
  1. #1
    Jcbconway is offline Senior Member
    Join Date
    Sep 2010
    Posts
    109
    Rep Power
    0

    Talking PaintComponant help

    Hello, unlike most of my questions i will not have source code for this unfortunately. i add elements to an array, then, i use the x,y from the points on the array to graph points on my screen through paint component. the problem i am having is i cannot paint multiple ovals on the screen. i use drawOval(px,py,3,3); px, and py, are the x's,and y's of the points in my array. problem is it paints one point, then when i add another point, it reprints the old point instead of adding a new one, and i dont know how to fix this haha.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,958
    Rep Power
    8

    Default

    We can't help without an SSCCE. It really shouldn't be hard to throw one together for this question.

  3. #3
    Jcbconway is offline Senior Member
    Join Date
    Sep 2010
    Posts
    109
    Rep Power
    0

    Default

    Well you obviously dont understand my point. i do not have a neat source for this. I could, but the sense of this should be somewhat easy to develop your own sense of the problem.

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,958
    Rep Power
    8

    Default

    Sure. This is a 20 line program. But the hard part is imagining where your problem is inside that program. We can't guess at that until we see some code.

  5. #5
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default

    do you have the problem after a second paintComponent/repaint call? or are you drawing the two ovals one after another in the paintComponent?

    in first case: you could draw on a bufferedimage and in your paintComponent you have to draw only that image. or you store the (oval) objects in a list, iterate over the list ..or... or .... --> read also Painting in AWT and Swing
    in second case: as has been said - show us code :)

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I agree, that we'll be much better able to help if we have code to base the problem and help on. I'm still not sure what's preventing you from creating and posting an SSCCE.

  7. #7
    Jcbconway is offline Senior Member
    Join Date
    Sep 2010
    Posts
    109
    Rep Power
    0

    Default

    The main reason is, its not a writen code problem, unlike most questions, its not actually a problem in any code i have, whereas normally i have a program i am working on and i run into a problem and the code is written, but this however is not a problem that is inflicting me, more so then just a problem i know off.

  8. #8
    Jcbconway is offline Senior Member
    Join Date
    Sep 2010
    Posts
    109
    Rep Power
    0

    Default

    Eraaaa, that was what i was looking for, i understand how i porly worded it now, but all i relly needed to know was if i needed to store the current image then just simple add to it opposed to re-drawing it. haha.

Posting Permissions

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