I have a complex program that reads Gerber files and renders a board
layout on a JPanel using java2d drawing functions. That works fine but
I'm bumping into a problem where some boards cause any future dialogs
in my program not to paint. This same phenomenon occurs with ALL
boards i zoom them to be too small, but there is no standard "too
small" it's different in each case. The behavior of other dialogs and
Panels besides the board layout is as such: they appear and all their
componenets are present, but they are covered in grey and the
components only SHOW if i select them. If i zoom any board in enough
so it's blown up enough, this stops happening.
So my question, is there some common problem with the 2DGraphics in
Java and drawing small objects that would cause this and I am just
unaware? Has anyone ever had a similar problem with dialog blocking,
and if so how did you solve it? I'd post code but there tens of
thousands of lines and i have no idea where this bug is originating
Thomas Fritsch - 29 Aug 2005 18:13 GMT
[...]
> The behavior of other dialogs and
> Panels besides the board layout is as such: they appear and all their
> componenets are present, but they are covered in grey and the
> components only SHOW if i select them. If i zoom any board in enough
> so it's blown up enough, this stops happening.
I would bet, that something is wrong in the painting stuff of your
application. This kind of malfunction is typical for an overridden
paint(Graphics g) method of a Container, where you forgot to call
super.paint(g)
> So my question, is there some common problem with the 2DGraphics in
> Java and drawing small objects that would cause this and I am just
> unaware?
[...]

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
ChooChooOnMyHead - 29 Aug 2005 19:01 GMT
Yeah, but the only painting i have overidden is the painting for the
layout drawing surface, a seperate panel. The Jdialogs that popup are
children of/anchored in the overall JFrame. So.....I don't know that
the painting of my JPanel would affect them, as it is also contained
within that Jframe
Roedy Green - 29 Aug 2005 23:01 GMT
>That works fine but
>I'm bumping into a problem where some boards cause any future dialogs
>in my program not to paint.
Is there any common code to your Board Displaying components and your
Dialog components other than Sun's code?
Dialogs are tricky beasts. Have a look at
http://mindprod.com/jgloss/dialog.html
it might give you an idea.
What happens if you make dialogs non-modal.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Roedy Green - 29 Aug 2005 23:18 GMT
> is there some common problem with the 2DGraphics in
>Java and drawing small objects that would cause this and I am just
>unaware?
There is the matter of tying up the Swing thread so that nothing else
gets a word in edgewise. Make sure your paint methods and event
handlers are not dawdling and heaven forbid, not sleeping or waiting.
Make sure you are not doing Swing operations from other threads
without invokeLater. See http://mindprod.com/jgloss/swing.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Roedy Green - 30 Aug 2005 01:06 GMT
>This same phenomenon occurs with ALL
>boards i zoom them to be too small, but there is no standard "too
>small" it's different in each case.
Have you tried instrumenting your paint method with a simple
start/done message? You may find that under some pathological
conditions your paint method goes into an infinite loop. Beware
comparing floats for equality. Perhaps some code goes nuts when there
are 0 of something.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
ChooChooOnMyHead - 31 Aug 2005 16:00 GMT
thanks roedy, when i get back around to a debug period instead of
design enhancement, I'll try these things and post if none work.
Thanks again for responding with so many possible solutions. Much Much
appreciated.