I have an issue with JPopupMenu, as the title tries to explain, it's drawing a white box over a major part of JDesktopPanel
This is the code that's responsible for creating the menu:
private void make_creature_creation(){
JPopupMenu CreateCreatureMenu = new JPopupMenu("Add Creature");
gameZone.addMouseListener(new MouseAdapter(){
@Override
public void mouseClicked(MouseEvent e){
if(e.getButton() == MouseEvent.BUTTON3){
CreateCreatureMenu.show(thisWorld,e.getX(), e.getY());
mouseX = e.getX();
mouseY = e.getY();
}
}}
);
for (String s : CC.getknownCreatures()) {
JMenuItem item = new JMenuItem(s);
item.addActionListener(new CustomActionListiner(s, this));
CreateCreatureMenu.add(item);
}
this.add(CreateCreatureMenu);
}
If the issue lies in how I draw the image on gameZone, here is code that's responsible for that
public void draw(){
Graphics g = gameZone.getGraphics();
g.clearRect(0, 0, gameZone.getWidth(), gameZone.getHeight());
g.setColor(new Color(255,255,255));
g.fillRect(0, 0, gameZone.getWidth(), gameZone.getHeight());
g.setColor(new Color(0,0,0));
g.drawRect(0, 0, gameZone.getWidth(), gameZone.getHeight()-1);
style.draw_grid(getColumnCount(), getRowCount(), gameZone);
for(Creature c : creatures){
c.draw();
}
}