How to get rid of Swing text box to enter the Chinese input window that pops up when

2010-12-31  来源:本站原创  分类:Java  人气:180 

java Swing inside the text box will pop up when you enter an "input window", the window looks very unhappy people.

How to get rid of Swing text box to enter the Chinese input window that pops up when

And has the following bug:

1. In some versions of the jvm, there are many layers of the modal dialog box when the top is a modal dialog box may be hidden, leading to find the dialog box.

2. In the "input window" will result in too many characters entered jvm crash

What is a good way to get rid of the "input window" it.

In fact, this problem is in jre rt.jar class in the class have sun.awt.im.InputMethodContext private static boolean belowTheSpotInputRequested; property xjad try to decompile the class we can see the following code:
static
{
String s = (String) AccessController.doPrivileged (new GetPropertyAction ("java.awt.im.style", null));
if (s == null)
{
Toolkit.getDefaultToolkit ();
s = Toolkit.getProperty ("java.awt.im.style", null);
}

belowTheSpotInputRequested = "below-the-spot". equals (s);
}

Because the system default style attribute is "below-the-spot" it will lead to belowTheSpotInputRequested = true; will lead to a small window when you enter the Chinese

Therefore, solutions
1. Is the main function System.setProperty ("java.awt.im.style", "on-the-spot");
2. The belowTheSpotInputRequested directly set to false, can be compiled into the rt.jar in the

How to get rid of Swing text box to enter the Chinese input window that pops up when

相关文章