@Override public String getText() { try { return String.format(source.getText(), currentThemeName); } catch (IllegalFormatException e) { CraftGuideLog.log(e); return "Current theme: " + currentThemeName; } }
private void recalculateHeight() { int textLeft = BORDER_THICKNESS + element.width() + BORDER_THICKNESS; int textRight = ConfigEntry.this.width() - BORDER_THICKNESS; String[] lines = layoutText(translatedText.getText(), textRight - textLeft); textDisplay.setText(lines); int textHeight = lines.length * 10 + BORDER_THICKNESS * 2; int elementHeight = element.height() + BORDER_THICKNESS * 2; int height = Math.max(textHeight, elementHeight); setSize(width(), height); if (textHeight > elementHeight) { textDisplay.setPosition(textLeft, BORDER_THICKNESS); element.setPosition(BORDER_THICKNESS, (height - element.height()) / 2); } else { textDisplay.setPosition(textLeft, (height - lines.length * 10 + 1) / 2); element.setPosition(BORDER_THICKNESS, BORDER_THICKNESS); } }