jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes adding swing component on canvas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "adding swing component on canvas" Watch "adding swing component on canvas" New topic
Author

adding swing component on canvas

cinderalla rahul
Greenhorn

Joined: Jan 11, 2002
Posts: 9
hello,
is it possible to add swing component JPanel,JLabel to canvas.
If so how, is it possible to do the following.

I have a JPanel which has background image.Two texfields are placed over the JPanel.
This I have done using Quicktime.
Backgroundimage is placed in JPanel by this method:
Image is placed in QTCanvas & then its placed in JPanel.
I have to place two JTextField in that JPanel.But i could not place it.How could i add components to JPanel which has Backgroundimage placed using QtCanvas.
I do get an exception while i am trying to place component over a panel which has QTCanvas.
Exception during add: java.lang.ClassCastException: java.awt.LightweightPeer

So pl.. suggest me a solution,immediately as soon as possible.
with regards,
cinderalla.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Cinderalla,
You can't overlap components. The only thing you can do is to draw the image onto the JPanel (i.e., overridding paintComponent method) and then place the JTextFields into the JPanel.
Regards,
Manfred.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: adding swing component on canvas
 
Similar Threads
placing swing components
QTCanvas(Quicktime) & JPanel
hi please help with conversion from awt to swing
About Canvas and Swing
QTCanvas (QuickTime) & java