@Override public void onStop() { if (nifty.getCurrentScreen() != null) { nifty.getCurrentScreen().endScreen(null); } }
/** * Invoked when the event is stopped. */ @Override public void onStop() { if (nifty.getCurrentScreen() != null) { nifty.getCurrentScreen().endScreen(null); } }
private void processSoftKeyboard() { SoftTextDialogInput softTextDialogInput = JmeSystem.getSoftTextDialogInput(); if (softTextDialogInput != null) { Element element = nifty.getCurrentScreen().getFocusHandler().getKeyboardFocusElement(); if (element != null) { final TextField textField = element.getNiftyControl(TextField.class); if (textField != null) { Logger.getLogger(InputSystemJme.class.getName()).log(Level.FINE, "Current TextField: {0}", textField.getId()); String initialValue = textField.getRealText(); if (initialValue == null) { initialValue = ""; } softTextDialogInput.requestDialog(SoftTextDialogInput.TEXT_ENTRY_DIALOG, "Enter Text", initialValue, new SoftTextDialogInputListener() { public void onSoftText(int action, String text) { if (action == SoftTextDialogInputListener.COMPLETE) { textField.setText(text); } } }); } } } } }
| nifty.getCurrentScreen().isMouseOverElement(); niftyOwnsDragging[button] = consumed; if (consumed) {
@Nullable public Element createPopupWithStyle( @Nonnull final String popupId, @Nonnull final String id, @Nullable final String style, @Nullable final Attributes parameters) { final Screen screen = getCurrentScreen(); if (screen == null) { return null; } return createPopupWithStyle(screen, popupId, id, style, parameters); }
/** * Create a new Image. This is a helper method so that you don't need to get the RenderEngine. * * @param name file name to use * @param filterLinear filter * @return RenderImage instance */ @Nullable public NiftyImage createImage(@Nonnull final String name, final boolean filterLinear) { final Screen screen = getCurrentScreen(); if (screen == null) { throw new IllegalStateException("Can't create a image with this method, while there is currently not active " + "screen"); } return renderEngine.createImage(screen, name, filterLinear); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element elementParameter, @Nonnull final EffectProperties parameter) { String target = parameter.getProperty("target"); if (target != null) { Screen screen = nifty.getCurrentScreen(); if (screen == null) { log.severe("Can't activate the effect while there is no screen selected as current."); } else { targetElement = screen.findElementById(target); } } }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element elementParameter, @Nonnull final EffectProperties parameter) { String target = parameter.getProperty("target"); if (target != null) { Screen screen = nifty.getCurrentScreen(); if (screen == null) { log.severe("Can't activate the effect while there is no screen selected as current."); } else { targetElement = screen.findElementById(target); } } }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { Screen screen = nifty.getCurrentScreen(); if (screen == null) { return; } TargetElementResolver resolver = new TargetElementResolver(screen, element); targetElement = resolver.resolve(parameter.getProperty("targetElement")); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { Screen screen = nifty.getCurrentScreen(); if (screen == null) { return; } TargetElementResolver resolver = new TargetElementResolver(screen, element); targetElement = resolver.resolve(parameter.getProperty("targetElement")); }
private void closeMessageBox() { clearButtons(); // messageboxPopup.findElementById("#messagebox").findElementById("#buttons"); nifty.getCurrentScreen().layoutLayers(); }
/** * Attempts to set the focus to this element. */ public void setFocus() { if (nifty.getCurrentScreen() != null) { if (isFocusable()) { focusHandler.setKeyFocus(this); } } }
private void closeMessageBox() { clearButtons(); // messageboxPopup.findElementById("#messagebox").findElementById("#buttons"); nifty.getCurrentScreen().layoutLayers(); }
public void show() { nifty.showPopup(nifty.getCurrentScreen(), messageboxPopup.getId(), null); }
public void show() { nifty.showPopup(nifty.getCurrentScreen(), messageboxPopup.getId(), null); }
@Override public void multiplayerCreate() { TextField player = screen.findNiftyControl("playerName", TextField.class); TextField game = screen.findNiftyControl("gameName", TextField.class); TextField port = screen.findNiftyControl("gamePort", TextField.class); state.multiplayerCreate(game.getRealText(), Integer.valueOf(port.getRealText()), player.getRealText()); // Overlay popupElement = nifty.createPopup("connectingLayer"); nifty.showPopup(nifty.getCurrentScreen(), popupElement.getId(), null); }
protected void showError(String title, String message) { closePopup(); // Open message popupElement = nifty.createPopup("errorMessage"); nifty.showPopup(nifty.getCurrentScreen(), popupElement.getId(), null); // Set message text Label titleLabel = popupElement.findNiftyControl("title", Label.class); titleLabel.setText(title); Label messageLabel = popupElement.findNiftyControl("message", Label.class); messageLabel.setText(message); }
public ModelViewerScreenController(ModelViewer app) { this.app = app; nifty = app.getNifty(); screen = nifty.getCurrentScreen(); // Set default font RenderFont font = nifty.createFont("Interface/Fonts/Frontend14.fnt"); nifty.getRenderEngine().setFont(font); nifty.registerMouseCursor("pointer", "Interface/Cursors/Idle.png", 4, 4); // Set some Nifty stuff nifty.addResourceBundle("menu", Main.getResourceBundle("Interface/Texts/Text")); nifty.addResourceBundle("speech", Main.getResourceBundle("Interface/Texts/Speech")); }
private void setupMessageBox() { final Element imgIcon = messageboxPopup.findElementById("#messagebox").findElementById("#message-icon"); final ImageRenderer iconRenderer = imgIcon.getRenderer(ImageRenderer.class); iconRenderer.setImage(icon); final Element text = messageboxPopup.findElementById("#messagebox").findElementById("#message-text"); final TextRenderer textRenderer = text.getRenderer(TextRenderer.class); textRenderer.setText(message); int i = 0; for (String buttonCaption : buttonCaptions) { i++; createButton(buttonCaption, buttonCaption, "button_" + i); } messageboxPopup.findElementById("#messagebox").layoutElements(); nifty.getCurrentScreen().layoutLayers(); }
private void setupMessageBox() { final Element imgIcon = messageboxPopup.findElementById("#messagebox").findElementById("#message-icon"); final ImageRenderer iconRenderer = imgIcon.getRenderer(ImageRenderer.class); iconRenderer.setImage(icon); final Element text = messageboxPopup.findElementById("#messagebox").findElementById("#message-text"); final TextRenderer textRenderer = text.getRenderer(TextRenderer.class); textRenderer.setText(message); int i = 0; for (String buttonCaption : buttonCaptions) { i++; createButton(buttonCaption, buttonCaption, "button_" + i); } messageboxPopup.findElementById("#messagebox").layoutElements(); nifty.getCurrentScreen().layoutLayers(); }