[quote]swpalmer,
First, thanx for your help. I tried to use the method you indicated but...... it doesn't work :-/ Note that I use JMenuBar / JMenu / JMenuItem in my code, not JPopupMenu. I guess there's no very difference between the concepts but perhaps these components are not managed in the same way. Do you see where the problem's coming from else?
(Iâve a screenshot of my application running -with the menu, cut when expanded over the canvas- but I have no personal server to put it on so you can see the bug)
Cheers! ;D
[/quote]
I doubt this is the problem, but it has the same symptomâŚ
Iâve seen the same problem before from a studentâs project, where he had made his program multi-threaded by overriding the AWT update method to do all his own âupdatesâ. He had no idea how to start a Thread / Runnable, but had managed to make an MT program this way :).
Very cunning, completely inadvertent - and of course he had no idea what was going on :(. One of the side effects was that everytime that re-painting was done by AWT for the Frame, he was overpainting with his own code. So the menus all got cut off (you could see them flick on very briefly before they were cut off).
Perhaps you are having a similar problem - check HOW, WHEN and WHY your paint() code gets invoked (nb: this is non-trivial. It can take quite a long time. My suggestion is to use the following little trick to find out:
// Stick this anywhere in your code when you want to find out where it's being called from
try
{
String a = null;
a.toString();
}
catch( Exception e )
{
// Wouldn't it be lovely if printStackTrace were accessible from Thread?
// ...surely that would be the correct place for it to live - NOT in Exception?
// Anyway, this works:
System.out.println( e.printStackTrace() );
}
Once youâve worked that out, check the Swing (and/or AWT) docs for the methods involved and make sure you are not accidentally abusing the spec.