aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes For each cicles question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "For each cicles question" Watch "For each cicles question" New topic
Author

For each cicles question

Pedro Carvalho
Greenhorn

Joined: Mar 25, 2013
Posts: 3
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

Joined: Aug 16, 2005
Posts: 14149
    
  18

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?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38818
    
  23
Welcome again
Are you using paintComponent() or similar?
Pedro Carvalho
Greenhorn

Joined: Mar 25, 2013
Posts: 3
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...




[Thumbnail for bug.png]

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38818
    
  23
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

Joined: Aug 16, 2005
Posts: 14149
    
  18

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

Joined: Mar 25, 2013
Posts: 3
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

Joined: Oct 13, 2005
Posts: 38818
    
  23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: For each cicles question