continue of above...post

in that example that i see the image.actaully i put it but its not work 4 me.

can u help me..i put my code here..


* To change this template, choose Tools | Templates
* and open the template in the editor.

package swingdemo;
import java.util.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

* @author vinod

public class TransparentBackground extends JComponent implements ComponentListener, WindowFocusListener,
Runnable,MouseListener {

private JFrame frame;
private Image background;
private long lastupdate = 0;
public boolean refreshRequested = true;

protected void processMouseEvent(MouseEvent e) {
JOptionPane.showMessageDialog(null, "processMouseEvent Called");

public TransparentBackground(JFrame frame) {
this.frame = frame;
updateBackground( );
new Thread(this).setPriority(Thread.MAX_PRIORITY);
new Thread(this).start( );

public void componentShown(ComponentEvent evt) {
// JOptionPane.showMessageDialog(null, "componentShown Data");
repaint( );
public void componentResized(ComponentEvent evt)
JOptionPane.showMessageDialog(null, "componentResized Called");
repaint( );
public void componentMoved(ComponentEvent evt)
JOptionPane.showMessageDialog(null, "componentMoved Called");
repaint( );
public void componentHidden(ComponentEvent evt)
// JOptionPane.showMessageDialog(null, "componentHidden Called");

public void windowGainedFocus(WindowEvent evt) { refresh( ); }
public void windowLostFocus(WindowEvent evt) { refresh( ); }

public void refresh( ) {
if(frame.isVisible( )) {
repaint( );
refreshRequested = true;
lastupdate = new Date( ).getTime( );

public void run( ) {
try {
while(true) {
long now = new Date( ).getTime( );
if(refreshRequested &&
((now - lastupdate) > 1000)) {
if(frame.isVisible( )) {
Point location = frame.getLocation( );
updateBackground( );
refresh( );
lastupdate = now;
refreshRequested = false; ...

Hi Ezzaral,

ya,u r right. i got one link after that post.


in this we take screenshot of and put it in background of our window.
and this process is continuosly work in thread.
ok it nice and some what help ful to me. but window is still not moving.

ok in one of the above post Mr.UNOwen's question was to change the shape of window.
i found one link 4 that.
plz check this.


Thanking you,
Ajay Patel


Hello Mr.UNOwen,

I have same problem and i need solution if u got that.

I am creating one applet and i draw one object on it but

I want a window of applet in the shape of the objct that i draw on window.
i need that window transparent such that I can draw object such that it looks as though the window is in the shape of
that object.So is there a way to get what's displayed behind the window and display it.

[B]Ajay Patel[/B]