@Nullable public Color color(@Nullable final String value) { if (value == null) { return null; } return new Color(value); }
@Nonnull public Color color(@Nullable final String value, @Nonnull final Color defaultColor) { if (value == null) { return defaultColor; } return new Color(value); }
@Nonnull private Color getDebugColor() { if (debugColor != null) { return debugColor; } final Random rnd = new Random(); debugColor = new Color(rnd.nextFloat(), rnd.nextFloat(), rnd.nextFloat(), .5f); return debugColor; }
@Nonnull public static Color randomColor() { Random random = new Random(); return new Color(random.nextFloat(), random.nextFloat(), random.nextFloat(), 1.f); } }
protected static TableColumn parse(String property) throws ClassNotFoundException { String[] params = property.split(";"); return new TableColumn(params[0], Integer.valueOf(params[1]), Class.forName(params[2]), new Color(params[3])); }
private void setResult(@Nonnull final String value, final int endIdx) { nextIndex = -1; color = null; isColor = Color.check(value); if (isColor) { color = new Color(value); nextIndex = endIdx; } } }
@Nullable public Color getAsColor(@Nonnull final String name) { String value = get(name); if (value == null) { return null; } return new Color(value); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { color = new de.lessvoid.nifty.tools.Color(parameter.getProperty("color", "#ffff")); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { color = new de.lessvoid.nifty.tools.Color(parameter.getProperty("color", "#ffff")); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { startColor = new Color(parameter.getProperty("startColor", "#00000000")); endColor = new Color(parameter.getProperty("endColor", "#ffffffff")); pulsator = new Pulsator(parameter, nifty.getTimeProvider()); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { startColor = new Color(parameter.getProperty("startColor", "#0000")); endColor = new Color(parameter.getProperty("endColor", "#ffff")); width = new SizeValue(parameter.getProperty("width")); }
private void setupPlayersTable(LobbyState lobbyState) { Element playersPanel = screen.findElementById("playersPanel"); // Build a new one PlayerTableBuilder cb = new PlayerTableBuilder(PLAYER_LIST_ID, new TableColumn("${menu.1688}", 34, String.class, new Color("#32050c30")), new TableColumn(lobbyState.isOnline() ? "${menu.263}" : "", 33, String.class, new Color("#32050c30")), new TableColumn(lobbyState.isOnline() ? "${menu.195}" : "", 11, String.class, new Color("#00752430")), new TableColumn(lobbyState.isOnline() ? "${menu.1499}" : "", 11, String.class, new Color("#00779e30")), new TableColumn(null, 11, Boolean.class, new Color("#00752430")) ) { { selectionModeSingle(); displayItems(4); optionalVerticalScrollbar(); } }; cb.build(nifty, screen, playersPanel); }
/** * Get parameter as Color instance. * * @param name the name of the attribute * @return the Color value of the attributes value */ @Nullable public Color getAsColor(@Nonnull final String name) { String value = get(name); if (value == null) { return null; } if (Color.check(value)) { return new Color(value); } return null; }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { startColor = new Color(parameter.getProperty("startColor", "#00000000")); endColor = new Color(parameter.getProperty("endColor", "#ffffffff")); width = new SizeValue(parameter.getProperty("width")); changeColorOnly = Boolean.valueOf(parameter.getProperty("changeColorOnly", "false")); pulsator = new Pulsator(parameter, nifty.getTimeProvider()); }
@Override protected void displayString(Element element, PlayerTableRow item, String itemData) { TextRenderer renderer = element.getRenderer(TextRenderer.class); renderer.setText(itemData); java.awt.Color c = MapThumbnailGenerator.getPlayerColor(item.getClientInfo().getKeeper().getId()); renderer.setColor(new Color(c.getRed() / 255.0f, c.getGreen() / 255.0f, c.getBlue() / 255.0f, 1f)); }
@Override public void renderQuad( final int x, final int y, final int width, final int height, @Nonnull final Color topLeft, @Nonnull final Color topRight, @Nonnull final Color bottomRight, @Nonnull final Color bottomLeft) { if (isColorAlphaChanged()) { Color a = new Color(topLeft, color.getAlpha()); Color b = new Color(topRight, color.getAlpha()); Color c = new Color(bottomRight, color.getAlpha()); Color d = new Color(bottomLeft, color.getAlpha()); renderDevice.renderQuad(x + getX(), y + getY(), width, height, a, b, c, d); } else { renderDevice.renderQuad(x + getX(), y + getY(), width, height, topLeft, topRight, bottomRight, bottomLeft); } }
@Override public final void display(final Element listBoxItem, final ChatEntry item) { final Element text = listBoxItem.findElementById(CHAT_LINE_TEXT); if (text == null) { log.severe("Failed to locate text part of chat line! Can't display entry."); } final TextRenderer textRenderer = text.getRenderer(TextRenderer.class); if (textRenderer == null) { log.severe("Text entry of the chat line does not contain the required text renderer."); return; } textRenderer.setText(item.getLabel()); // If keeper ID is set, color the line if (item.getKeeperId() != 0) { java.awt.Color c = MapThumbnailGenerator.getPlayerColor(item.getKeeperId()); textRenderer.setColor(new Color(c.getRed() / 255.0f, c.getGreen() / 255.0f, c.getBlue() / 255.0f, 1f)); } else { textRenderer.setColor(new Color("#bbbcbb")); } }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { // startColor and endColor (only alpha component used) are the old version of this // and are kept here only for backward compatibility. The current attributes are "start" and "end" alpha values. if (parameter.getProperty("startColor") != null) { start = new Alpha(new Color(parameter.getProperty("startColor", "#000000ff")).getAlpha()); } if (parameter.getProperty("endColor") != null) { end = new Alpha(new Color(parameter.getProperty("endColor", "#ffffffff")).getAlpha()); } if (parameter.getProperty("start") != null) { start = new Alpha(parameter.getProperty("start")); } if (parameter.getProperty("end") != null) { end = new Alpha(parameter.getProperty("end")); } interpolator = parameter.getInterpolator(); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { color = new Color(parameter.getProperty("color", "#ffffffff")); width = new SizeValue(parameter.getProperty("width")); try { PaddingAttributeParser parser = new PaddingAttributeParser(parameter.getProperty("inset", "0px")); insetLeft = new SizeValue(parser.getLeft()); insetRight = new SizeValue(parser.getRight()); insetTop = new SizeValue(parser.getTop()); insetBottom = new SizeValue(parser.getBottom()); } catch (Exception e) { log.warning(e.getMessage()); } }