Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

For each cicles question

 
Pedro Carvalho
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys
i have a problem, first i have two cicles for each to print a line like a cross to an object, thats actualize the line when the object moves, my problem is when i got two objects pointing to the same object, the cross line of the first targeting him, dont desapears from the map and i dont know why.

sorry for my bad english
Thanks
Entertainer
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

From just a description it's impossible to help you with the problem. What is your program about? Can you show us your code and explain in more detail what your question is about?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again
Are you using paintComponent() or similar?
 
Pedro Carvalho
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes is someting like paintComponent
code"


My objective is target 2 objects at the same time( two or more towers pointing at objects if they are in range), i think the problem is when we change the tower s(variable) turns null but i dont know why...

bug.png
bug
[Thumbnail for bug.png]
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pedro Carvalho wrote: . . .

. . .
Never use == true or == false. I know you have //commented it out, but I can see it, even in green
I have added code tags to your code, and you can see it looks much better.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the displayer object that window.getDisplayer() returns?

Maybe there is a bug in how the displayer draws objects. Does it clear the background before painting the objects? If not, you might see the old picture behind the new picture when things are being drawn.
 
Pedro Carvalho
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the displayer object that window.getDisplayer() returns?


it returns my scenario, a image, I think the problem is when i am inside the cicle i cant let s variable switching values from tower1 and tower2 you know what i mean?

i can acess to variable s from 2 objects tower1 and tower2 at the same time, but i dont find why yet.

 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should write
if (b)... not if (b == true)... and
if (!b)... not if (b == false)...
You can get dreadful errors if you write = instead of == by mistake.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic