I have a JLabel(L1) on a JPanel(P2) with a JScrollPane all on another JPanel(P1), which also has several other JPanels on it.
I want to be able to click and drag L1 anywhere on P1. To do this I need to paint over everything which mean I need P1 to paint.
I'm assuming to override the paintComponent method would be easiest.
If I try to just paint (g.drawString(str,x,y)) then everything I paint is underneath all the components. I can use (super.getGraphics().drawString(str,x,y,z)) but that either doesn't show up or flashes.
I need something like (super.getGraphics().drawString(str,x,y,z)) but doesn't flash.
P.S. If anybody knows how to paint directly onto the screen instead of only inside frames it would be helpful to have an example of how to do it.