×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Massimo Zappino
Added: Jan 19, 2016 1:58 PM
Modified: Aug 27, 2017 3:33 PM
Views: 12
  1. Font f = label.getFont();
  2. // bold
  3. label.setFont(f.deriveFont(f.getStyle() | Font.BOLD));
  4.  
  5. // unbold
  6. label.setFont(f.deriveFont(f.getStyle() & ~Font.BOLD));
  7.  
  8. // toggle bold
  9. label.setFont(f.deriveFont(f.getStyle() ^ Font.BOLD));