2 font styles at once with swing

4

I need a little hand, I'm with swing and to apply a font to a text I can only enter the classic parameters:

Font despues= new Font(estilo,Font.ITALIC,tamaño);

The fact is that I need to use 2 font styles at the same time, specifically italic and bold.

Thank you.

    
asked by Fausto Jeje 16.05.2018 в 23:13
source

1 answer

3

You can create a combination of both using | to use Italic and Bold:

Font myFont =  new Font(estilo,  Font.BOLD | Font.ITALIC ,tamano);

or you can also use +

   Font myFont =  new Font(estilo,  Font.BOLD + Font.ITALIC ,tamano);
    
answered by 16.05.2018 / 23:16
source