io.github.dinamo541.corefx.ui

Message

Static utilityUtilidad estática final JavaFX

The lightweight, theme-free counterpart to AlertUtil. A pure static utility for showing error / warning / confirmation / information dialogs, with automatic content wrapping and smart width sizing based on message length. La contraparte ligera y sin tema de AlertUtil. Una utilidad puramente estática para mostrar diálogos de error / advertencia / confirmación / información, con ajuste automático del contenido y dimensionado inteligente del ancho según la longitud del mensaje.

🧰
All methods are static — do not instantiateTodos los métodos son estáticos — no instanciar

Message has a private constructor. Call its methods directly: Message.show(...). (It was a singleton in earlier versions; v1.2.0 made it a pure static utility, consistent with the other UI helpers.)Message tiene un constructor privado. Llama a sus métodos directamente: Message.show(...). (Era un singleton en versiones anteriores; la v1.2.0 lo convirtió en una utilidad puramente estática, en consonancia con los demás ayudantes de UI.)

Quick startInicio rápido

// Non-blocking notice:
Message.show(AlertType.INFORMATION, "Welcome", "Signed in successfully.");

// Blocking, owned by a window:
Message.showModal(AlertType.ERROR, "Failed", owner, "Could not reach the server.");

// Confirmations returning a boolean:
boolean ok  = Message.showConfirmation("Delete?", owner, "Remove this record?");
boolean yes = Message.askYesOrNoBoolean("Quit", owner, "Exit the application?");

Dialog methodsMétodos de diálogo

static void show(AlertType alertType, String title, String message)

Non-modal alert; does not block. alertType is one of ERROR, WARNING, CONFIRMATION, INFORMATION.Alerta no modal; no bloquea. alertType es uno de ERROR, WARNING, CONFIRMATION, INFORMATION.

static void showModal(AlertType alertType, String title, Window parent, String message)

Modal alert owned by parent; waits for the user to respond.Alerta modal con owner parent; espera a que el usuario responda.

static boolean showConfirmation(String title, Window parent, String message)

OK / Cancel. Returns true only if the user clicked OK.Aceptar / Cancelar. Devuelve true solo si el usuario pulsó Aceptar.

static boolean askYesOrNoBoolean(String title, Window parent, String message)

Yes / No (instead of Cancel / OK). Returns true only if Yes was clicked.Sí / No (en vez de Cancelar / Aceptar). Devuelve true solo si se pulsó Sí.

HelpersAyudantes

static ImageView loadIcon(String path)

Loads an icon and scales it to 32×32. Resolution is delegated to ImageUtil, so classpath resources, URLs and local files all work. Throws IllegalArgumentException if path is null/blank or unloadable.Carga un icono y lo escala a 32×32. La resolución se delega en ImageUtil, así que funcionan recursos del classpath, URLs y archivos locales. Lanza IllegalArgumentException si path es null/en blanco o no se puede cargar.

static void applyButtonsStyles(Alert alert)

Adds the btn-accept style class to OK / "Aceptar" buttons and btn-cancel to Cancel / "Cancelar" buttons, so your stylesheet can target them. Rejects a null alert.Añade la clase de estilo btn-accept a los botones OK / "Aceptar" y btn-cancel a los botones Cancel / "Cancelar", para que tu hoja de estilo pueda apuntarlos. Rechaza una alerta null.

Automatic content sizingDimensionado automático del contenido

Every dialog wraps its text and computes a preferred width from the longest line — roughly 7px × longest line + 160, clamped to [380, 720] pixels. Long messages wrap instead of stretching off-screen. (This is the same sizing AlertUtil uses.) Cada diálogo ajusta su texto y calcula un ancho preferido a partir de la línea más larga — aproximadamente 7px × línea más larga + 160, acotado a [380, 720] píxeles. Los mensajes largos se ajustan en vez de estirarse fuera de la pantalla. (Es el mismo dimensionado que usa AlertUtil.)

When to choose MessageCuándo elegir Message

Reach for Message when you want the lightest, theme-free dialog and don't need CSS theming. If you do want dark/branded dialogs, use AlertUtil instead — the two are otherwise interchangeable.Usa Message cuando quieras el diálogo más ligero y sin tema y no necesites theming con CSS. Si sí quieres diálogos oscuros/de marca, usa AlertUtil en su lugar — por lo demás son intercambiables.

🧵
FX thread for blocking callsHilo de FX para llamadas bloqueantes

showModal, showConfirmation and askYesOrNoBoolean block via showAndWait() and must run on the JavaFX Application Thread.showModal, showConfirmation y askYesOrNoBoolean bloquean vía showAndWait() y deben ejecutarse en el JavaFX Application Thread.