Java tutorial
//package com.java2s; import java.awt.Component; import java.awt.Font; public class Main { /** * Set {@link #deriveHeader2(Component)} font on component. * @param context */ public static void setHeader2(Component context) { context.setFont(deriveHeader2(context)); } /** * Tries to derive a default header font from given context. * * @param context * @return */ public static Font deriveHeader2(Component context) { return context.getFont().deriveFont(Font.BOLD, 12); } }