I have a JPanel which has few JComponents added to it. I have overridden paintComponent method of JPanel where I am drawing some shapes on JPanel.
public void paintComponent(Graphics g){
super.paintComponent(g);
g.fillOval(20, 6, 12, 12);
g.setColor(Color.BLUE);
g.setFont(FontStore.FRIENDS_BLOCK_OPTION_FONT);
g.drawString("12", 26, 12);
g.setColor(Color.BLACK);
}
However the shapes which I am drawing through paintComponent is rendering behind the JComponent. How can I draw shapes whose z-index is higher than components added to JPanel ?
If possible, use either a Glass Pane or JLayer to paint over other components