I have a JLabel that is ontop of a JButton, but it will not show up ontop. When the code for the JButton is commented out, the JLabel is shown, meaning that it is there but is o
Swing paint components based on the ZOrder of the component. Basically the last component added is painted first.
So you could achieve what you want by doing:
c.add(button);
c.add(label);
Although, I agree with the comments. What are you trying to do? There is probably a better solution. It is almost never a good idea to be using setBounds() to position and size a component.
I need this for my game where when the button is clicked, a JLabel will be shown ontop of the button to display a "score" that is added.
If you are going to force the user to click a button to display the score then you should probably be using a JOptionPane
to display the label. Otherwise how will the label disappear? Forcing the user to click on the same button is not a very good UI.