示例#1
0
 public void updateMessage() {
   if (messageSelector.getValue().equals(english)) {
     messageText.setText(englishMessage);
     okayButton.setLabel("Change the language");
   } else if (messageSelector.getValue().equals(french)) {
     messageText.setText(frenchMessage);
     okayButton.setLabel("Change la langue");
   } else if (messageSelector.getValue().equals(spanish)) {
     messageText.setText(spanishMessage);
     okayButton.setLabel("Cambie el lenguaje");
   } else if (messageSelector.getValue().equals(polish)) {
     messageText.setText(polishMessage);
     okayButton.setLabel("Zmien jezyk");
   } else if (messageSelector.getValue().equals(german)) {
     messageText.setText(germanMessage);
     okayButton.setLabel("Andern Sie die Sprache"); // €ndern Sie die Sprache
   }
 }
示例#2
0
  public TrivialMauiApplication(Object aInitializer) {
    super(aInitializer, "Trivial Maui App");

    window = new MFrame("Trivial Maui App", 250);

    messageText = new MLabel(englishMessage);
    window.add(messageText);

    String[] selectListItems = {english, french, spanish, polish, german};
    messageSelector = new MSelectList(selectListItems);
    window.add(messageSelector);

    // OK MButton
    okayButton = new MButton("Change the language");
    okayButton.addActionListener(
        new MActionListener() {
          public void actionPerformed(MActionEvent event) {
            TrivialMauiApplication.this.updateMessage();
          }
        });
    window.add(okayButton);

    add(window);
  }