2016년 8월 2일 화요일

[Forms] Web Forms에서 한/영 자동 변환 자바 소스



// Note 438648.1



ChangeInputMethodOnFocus.java

package formsUI;
import java.awt.Component;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.im.InputContext;
import java.util.Locale;
public class ChangeInputMethodOnFocus extends FocusAdapter {
Locale _locale;
Locale defLocale;
public ChangeInputMethodOnFocus(Locale locale) {
_locale = locale;
}
public void focusGained(FocusEvent fe) {
Component c = fe.getComponent();
InputContext inputContext = c.getInputContext();
defLocale = inputContext.getLocale();
inputContext.selectInputMethod(_locale);
// Added by swan
if (_locale != null) {
if (_locale == Locale.KOREAN) {
Character.Subset[] subset = { Character.UnicodeBlock.HANGUL_SYLLABLES };
inputContext.setCharacterSubsets(subset);
} else {
Character.Subset[] subset = null;
inputContext.setCharacterSubsets(subset);
}
}
}
public void focusLost(FocusEvent fe) {
Component c = fe.getComponent();
InputContext inputContext = c.getInputContext();
inputContext.selectInputMethod(defLocale);
}
}

VTextFieldKor.java
package formsUI;
import java.util.Locale; import oracle.forms.handler.IHandler; import oracle.forms.ui.VTextField;
@SuppressWarnings("serial")public class extends VTextField {  public void init(IHandler ih) {  super.init(ih);  //ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (new Locale("ko","KR"));  ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (Locale.KOREAN);  this.addFocusListener(focusAdapter);  }

VTextFieldEng.java

package formsUI;
import java.util.Locale; import oracle.forms.handler.IHandler; import oracle.forms.ui.VTextField;
@SuppressWarnings("serial")public class VTextFieldEng extends VTextField {  public void init(IHandler ih) {  super.init(ih);  //ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (new Locale("en","US"));  ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (Locale.ENGLISH);  this.addFocusListener(focusAdapter);  }


VTextAreaKor.java
package formsUI;
import java.util.Locale; import oracle.forms.handler.IHandler; import oracle.forms.ui.VTextArea;
@SuppressWarnings("serial")public class VTextAreaKor extends VTextArea {  public void init(IHandler ih) {  super.init(ih);  //ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (new Locale("ko","KR"));  ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (Locale.KOREAN);  this.addFocusListener(focusAdapter);  }

VTextAreaEng.java
package formsUI;
import java.util.Locale; import oracle.forms.handler.IHandler; import oracle.forms.ui.VTextArea;
@SuppressWarnings("serial")public class VTextAreaEng extends VTextArea {  public void init(IHandler ih) {  super.init(ih);  //ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (new Locale("en","US"));  ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (Locale.ENGLISH);  this.addFocusListener(focusAdapter);  }


댓글 없음:

댓글 쓰기