for some reasons, we have an application built with WPF 4, but in some cases we have to show a windows built using java swing. The problem is, you can set some Window as parent of some dialog or other windows, but always in the same technology.
But when we launch another window that is not built using WPF is very easy to that window to be hidden behind WPF app, and is not easy way to put in front WPF.
Is there any way to put that Java windows "on top" of WPF app?
Window#toFront()
and Window#setAlwaysOnTop()
can help.
If you need to set window always on top, use setAlwaysOnTop()
method.
If you want window to get focus, toFront()
or setAutoRequestFocus()
may help.
Try this:
import javax.swing.JFrame;
public class NewClass1 {
public static void main(String[] args) {
JFrame frame = new JFrame("On Top");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(100, 100);
frame.setVisible(true);
frame.toFront();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With