Example usage for java.awt.im.spi InputMethodContext createInputMethodWindow

List of usage examples for java.awt.im.spi InputMethodContext createInputMethodWindow

Introduction

In this page you can find the example usage for java.awt.im.spi InputMethodContext createInputMethodWindow.

Prototype

public Window createInputMethodWindow(String title, boolean attachToInputContext);

Source Link

Document

Creates a top-level window for use by the input method.

Usage

From source file:SimpleInputMethod.java

public void setInputMethodContext(InputMethodContext context) {
    inputMethodContext = context;/*www  .  java 2  s .  c  o m*/
    if (statusWindow == null) {
        statusWindow = context.createInputMethodWindow("Simple Input Method", false);
        Label label = new Label();
        label.setText(locale.getDisplayName());
        statusWindow.add(label);
        label.setSize(200, 50);
        statusWindow.add(label);
        statusWindow.pack();

        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        statusWindow.setLocation(d.width - statusWindow.getWidth(), d.height - statusWindow.getHeight());
    }
}