private void initialize() {
    List<Control> children = new ArrayList<>(Arrays.asList(shlMyanmarTyping.getChildren()));
    while (!children.isEmpty()) {
      Control c = children.remove(0);
      if (c instanceof Composite) {
        children.addAll(Arrays.asList(((Composite) c).getChildren()));
      } else if (c instanceof Button) {
        Button b = (Button) c;
        MMKey key = MMKey.ALL_MM_KEY_MAP.get(b.getText().charAt(0));
        if (key != null) {
          b.setData(key);
          b.setText(key.toString());
          b.addSelectionListener(listener);
        }
      }
    }

    text.addModifyListener(modifyListener);
    text_5.addModifyListener(modifyTextListener);

    text_1.setEditable(false);
    text_2.setEditable(false);
    text_3.setEditable(false);
    text_4.setEditable(false);
    text.setFocus();
    text.setText(defaultText);
    text_5.setText("100F");
  }
예제 #2
0
  /** Create contents of the window. */
  protected void createContents() {
    shlMyanmarTyping = new Shell();
    shlMyanmarTyping.setSize(785, 500);
    shlMyanmarTyping.setText("Myanmar Typing");
    shlMyanmarTyping.setLayout(new BorderLayout(0, 0));

    text = new Text(shlMyanmarTyping, SWT.BORDER);
    text.setLayoutData(BorderLayout.NORTH);

    Composite unicodeKeyPanel = new Composite(shlMyanmarTyping, SWT.NONE);
    unicodeKeyPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1));
    unicodeKeyPanel.setLayoutData(BorderLayout.CENTER);

    for (MMKey key : MMKey.ALL_MM_KEYS) {
      Button btnNewButton = new Button(unicodeKeyPanel, SWT.NONE);
      btnNewButton.setText(key.toUnicode());
      btnNewButton.setData(key);
      btnNewButton.addSelectionListener(listener);
    }
  }
예제 #3
0
 @Override
 public void widgetSelected(SelectionEvent e) {
   MMKey key = (MMKey) e.widget.getData();
   text.append(key.toUnicode());
 }