Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JOptionPane show Message Dialog always on top found a Solution

843806May 2 2009 — edited May 3 2009
just thought of a solution for the age old java problem with message boxes / dialogs / input .

It's funny when you google it you'll find like a million people asking for a solution but none or very few that gives an answer that works.

this is probly not a new solution but i came up with this yesterday and thought i would "share".

dunno why the java developers hasnt made a always on top function for this since there seems to be a very high demand for it.

this hax will hopefully work at all times.

hope google will find this thread, i searched for a solution yesterday and found none? which is surprising and im a pro googler too.
import javax.swing.*;

public class main{

	public static void main(String args[]){
		JFrame j=new JFrame();
		j.setAlwaysOnTop(true);
		j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		j.setVisible(true);
		j.setVisible(false);
		JOptionPane.showMessageDialog(j,"hi");
		System.exit(0);
	}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 31 2009
Added on May 2 2009
2 comments
7,939 views