DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Posts
    1

    Question popup menu appears behind images

    I'm building a project that displays images on the screen, when the user right clicks on them, a popup menu pops up.

    The problem is that the popup menu appears behind the images. Anyone know why?

    Some snippets of code:

    //in MousePressed() function

    objectPopup.show(this,x,y);

    //in paint() function

    g2.drawImage(myGraphics.capitalImage,
    object[j].position.x-15,object[j].position.y-15,
    imageSize, imageSize, null,this);


    I've tried using the glass pane, but couldn't get that to work, and I also set the popup menu to be heavyweight, which did make the popup menu appear above the images, but the submenus were still below, and also it couldn't detect when I clicked on a menu item.

    Thanks in advance for any help

  2. #2
    Join Date
    Nov 2002
    Posts
    59
    Be sure to call super.paint() as the first line in your paint method...not sure if this will compeletely resolve it, but can help to resolve alot of other issues as well.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links