/** * Set short description of action. Used for tooltip text. If {@code null} * is specified, any existing value is lost (removed). * * @param description Short description. * * @see #SHORT_DESCRIPTION */ public void setShortDescription( final String description ) { putValue( SHORT_DESCRIPTION, TextTools.plainTextToHTML( description ) ); }
/** * Show warning message dialog. * * The message can contain HTML formatting codes. * * @param owner Parent component (if {@code null}, a default {@link Frame} * is used). * @param title Dialog title. * @param message Content message. */ public static void showWarningDialog( @Nullable final Component owner, @Nullable final String title, @Nullable final String message ) { showMessageDialog( owner, title, TextTools.plainTextToHTML( message ), JOptionPane.WARNING_MESSAGE, 0 ); }
final int response = JOptionPane.showConfirmDialog( owner, TextTools.plainTextToHTML( message ), title, JOptionPane.YES_NO_CANCEL_OPTION ); switch ( response )
/** * Show error message dialog. The error is also printed on {@link * System#err}. * * The message can contain HTML formatting codes. * * @param owner Parent component (if {@code null}, a default {@link Frame} * is used). * @param title Dialog title. * @param message Content message. */ public static void showErrorDialog( @Nullable final Component owner, @Nullable final String title, @Nullable final String message ) { System.err.println( TextTools.getFixed( "----[ " + title + ']', 80, false, '-' ) ); System.err.println( message ); System.err.println( TextTools.getFixed( 80, '-' ) ); showMessageDialog( owner, title, TextTools.plainTextToHTML( message ), JOptionPane.ERROR_MESSAGE, 0 ); }
dialog.setResizable( false ); final JLabel label = new JLabel( TextTools.plainTextToHTML( message ) ); if ( font != null )
contentPane.add( new JLabel( TextTools.plainTextToHTML( message ), JLabel.CENTER ), BorderLayout.CENTER );