All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.lessvoid.nifty.examples.defaultcontrols.messagebox.MessageBoxDialogController Maven / Gradle / Ivy

Go to download

Lots of Nifty example code! You can find the source for nearly all demos/tutorials in here.

The newest version!
package de.lessvoid.nifty.examples.defaultcontrols.messagebox;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.controls.Controller;
import de.lessvoid.nifty.controls.MessageBox;
import de.lessvoid.nifty.controls.MessageBox.MessageType;
import de.lessvoid.nifty.controls.Parameters;
import de.lessvoid.nifty.elements.Element;
import de.lessvoid.nifty.input.NiftyInputEvent;
import de.lessvoid.nifty.screen.Screen;

import javax.annotation.Nonnull;

public class MessageBoxDialogController implements Controller {

  private Nifty nifty;

  @Override
  public void bind(
      @Nonnull Nifty nifty,
      @Nonnull Screen screen,
      @Nonnull Element element,
      @Nonnull Parameters parameter) {
    System.out.println("binding MessageBoxDialogController");
    this.nifty = nifty;
  }

  @Override
  public void init(@Nonnull Parameters parameter) {
  }

  @Override
  public void onStartScreen() {
  }

  @Override
  public void onFocus(boolean getFocus) {
  }

  @Override
  public boolean inputEvent(@Nonnull NiftyInputEvent inputEvent) {
    return false;
  }

  @Override
  public void onEndScreen() {

  }

  public void displayMessageBoxOk() {
    System.out.println("displaying ok message box");
    // create the messagebox with just the ok button
    new MessageBox(nifty, MessageType.INFO, "Just showing an info messagebox with one button", "Ok").show();
  }

  public void displayMessageBoxOkCancel() {
    System.out.println("displaying ok/cancel message box");
    // create the messagebox with the ok and cancel button
    new MessageBox(nifty, MessageType.INFO, "Just showing an info messagebox with two buttons", new String[] { "Ok", "Cancel" }).show();
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy