Can i create "Always on top" funciton in JAVA?

Hi, my name is Chang Hee Lee and I am a programmer in South Korea. We are developing a messenger program in JAVA. I have been trying to create a tool like MSN messenger's "Always on top" function under Tools in the menu bar.

I could not find any way to develope the same function in JAVA. I would appreciate it if you could help me solve this problem. If you have any idea how to enable "Always on top" finction with JAVA, please send me an e-mail toc-hee@honmail.net Thank you.

[508 byte] By [kostrich] at [2007-9-26 23:27:23]
# 1

Try this code. It should be work on all windows which are inherited from java.awt.Window

/**

* Call this from class consructor

*/

public void initialize() {

TopThread top = new TopThread();

top.start();

}

/**

* Keep JWindow on top (inner class)

*/

class TopThread extends Thread {

public void run() {

while(true) {

toFront();

/**

* Let 10 milliseconds for other code to execute

*/

try {

Thread.sleep(10);

}

catch(Exception e) {

// Nothing to do

}

}

}

}

timovaa at 2007-7-4 12:56:00 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 2
Put a WindowAdapter on your window and call toFront on the window inWindowAdapter.windowDeactivated.
willcox at 2007-7-4 12:56:00 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...