Under certain condition, my j3d application's popup
does not repair itself when it becomes invisible.
I have spent about a week investigating the problem,
going through swing/awt paint/event code and pretty
much did all I can do. I need some help from J3d folks.
I am not sure this is a j3d or swing/awt
problem. If this is not a j3d problem, most likely
it's a JTabbedPane problem. I traced all the way
down to toolkit's event loop code that generates
handleExpose stuff (saw it in debugger) for the peer.
Unfortunately, the event loop is implemented in native
code.
Anyway, below are the detail description of
the problem and a sample program. The sample
program sort of shows the behavior of my application.
I was not able to create a simple sample to exactly
show the behavior of my application.
Description:
The containment hierarchy of my application looks
like:
------------------------------------------------
| ----------------------------------------- |
| | menubar | |
| ----------------------------------------- |
| ------------------------------------------- |
| | ------- ----------------------------- ||
| | | | | ------------------------- |||
| | | | | | --------------------- ||||
| | | | | | | ---------------- |||||
| | | | | | | | | |||||
| | | | | | | | | |||||
| | | | | | | | Canvas3D | |||||
| | | | | | | ---------------- |||||
| | | | | | |JPanel |||||
| | | | | | --------------------- ||||
| | | | | | JScrollPane ||||
| | | | | ------------------------- |||
| | |JTree | |JTabbedPane |||
| | ------- ---------------------------- ||
| |JSplitPane ||
| ------------------------------------------- |
-----------------------------------------------
Behaviors:
Right click on JTree brings up a MediumWeight JPopupMenu
(or setLightWeightPopupEnabled to false). Right click on
Canvas3D brings up a PopupMenu (heavyweight).
Problem:
1) Right mouse click on JTree (or left pane) to bring
up the JPopupMenu
(or click on menubar to bring down a menu)
2) Right mouse click on Canvas3D to bring up the PopupMenu.
At this time, the JPopupMenu remains on the screen.
My investigation found the JPopupMenu.setVisible gets
called properly. The damage areas are set properly.
The problem is the PaintEvent does not get generated
for the repair. Explicitly call the RepaintManager's
paintDirtyRegions does not help. I also tried different
tricks and nothing seemed to be able to get the JPopupMenu
area repainted properly.
Anyway, enclosed is a revised HelloWorld.java that sort
of show the problem (I hope!).
Yang
HelloUniverse.java