Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-04-2008, 06:55 AM
Member
 
Join Date: Dec 2008
Posts: 1
Rep Power: 0
beam2008 is on a distinguished road
Default 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
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 12-05-2008, 05:15 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 6,504
Rep Power: 8
Fubarable is on a distinguished road
Default
Have you looked into using a JLayeredPane?
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
add remove swing components willemjav New To Java 6 10-09-2008 08:37 PM
Tab order on swing components ashvin@projectdemo.biz AWT / Swing 1 05-31-2008 11:06 AM
Where is it best to declare swing components? MacNstuff AWT / Swing 1 02-06-2008 01:59 AM
Removing components from JPanel Echilon New To Java 0 12-30-2007 05:05 PM
HTML on Swing Components Java Tip Java Tips 0 11-27-2007 10:51 AM


All times are GMT +2. The time now is 12:01 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org