Results 1 to 2 of 2
- 12-04-2008, 06:55 AM #1Member
- Join Date
- Dec 2008
- Rep Power
help?! paint on top of swing components on JPanel
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.
Last edited by beam2008; 12-04-2008 at 04:07 PM. Reason: accident smileys
- By willemjav in forum New To JavaReplies: 6Last Post: 10-09-2008, 07:37 PM
- By firstname.lastname@example.org in forum AWT / SwingReplies: 1Last Post: 05-31-2008, 10:06 AM
- By MacNstuff in forum AWT / SwingReplies: 1Last Post: 02-06-2008, 01:59 AM
- By Echilon in forum New To JavaReplies: 0Last Post: 12-30-2007, 05:05 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 11-27-2007, 10:51 AM