paintComponent not being called on my glasspane
here is some code for a glasspane that I have.
For some reason, it never hits the paintComponent.
My program does:
publicclass GlassPaneextends JPanel{
/** Creates a new instance of glassPane */
public GlassPane(){
}
publicvoid cashierAction(JPanel panel,int initialX,int initialY){
frame = (JFrame)SwingUtilities.getAncestorOfClass(JFrame.class, panel);
glass = (JPanel) frame.getGlassPane();
//glass.setLayout(null);
xPos = initialX;
yPos = initialY;
glass.setVisible(true);
cashierAnimation =true;
repaint();
}
publicvoid paintComponent(Graphics g){
Graphics2D g2d = (Graphics2D)g;
super.paintComponent(g);
if(cashierAnimation){
g2d.drawImage(this.dollarSign, xPos, yPos, 10, 10,null);
}
}
private JFrame frame;
private JPanel glass;
privateint xPos;
privateint yPos;
privateboolean cashierAnimation =false;
private ImageIcon dollarImg =new ImageIcon("Data/Icons/dollar.gif");
private Image dollarSign = dollarImg.getImage();
}
Any ideas why it is not running the paintComponent?
I am pretty new to glass panes, I have gotten them to work with buttons, and other items, but painting on them is driving me crazy.

