0

I have a font variable static public Font bold_13 = new Font("Arial", Font.BOLD, 13); which is set to text. Now based on some condition I need to change the style of the font.

One possible solution which i found was

field.setFont(field.getFont().deriveFont(Font.ITALIC));

I cant use the same in my application because I dont know the field when i am changing the style. So I cant use like field.setFont!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
MRavindran
  • 447
  • 2
  • 10
  • 24
  • For all fields? Or do you rather wish to retrieve which field is concerned. From most listeners, the `event.getSource()` will provide that info. – Joop Eggen Jul 27 '15 at 10:08
  • I mentioned in my question that I already saw the solution which you have pointed out but I can not use the same in my application. – MRavindran Jul 27 '15 at 10:08
  • *"..I dont know the field.."* Why not? For better help sooner, post a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). – Andrew Thompson Jul 27 '15 at 14:49

0 Answers0