Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adding swing component on canvas

 
cinderalla rahul
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic