JOptionPane, How to give bold format only to a part of the text of the component

0

How to put a message in bold I have this example

For saying I have this code:

public void pedirFecha(){
JDateChooser jd = new JDateChooser(); 
String message = "porfavor ingrese una fecha ";
Object[] params = {message, jd};
params[0] =   message.concat("\n FECHA NO DISPONIBLE: La fecha  ingresada 
ya fue asignada para  esta operacion");  // esto debe ir en negrita
int nbot=0;
 nbot= JOptionPane.showConfirmDialog(null, params, "INDEXACION ", 
JOptionPane.OK_CANCEL_OPTION);
}
    
asked by Fabian Peñaloza 24.08.2018 в 23:10
source

1 answer

0

One option is to create a JLabel and assign it the format you need.

    JLabel etiqueta = new JLabel("elMensaje");
    etiqueta.setFont(new Font("Arial", Font.BOLD, 30));
    JOptionPane.showMessageDialog(null, etiqueta, "elTitulo", JOptionPane.WARNING_MESSAGE);

That would make it

Greetings.

    
answered by 25.08.2018 в 09:23