Java Swing Font boldFont(JComponent component)

Here you can find the source of boldFont(JComponent component)

Description

Updates a font in a component to be bold.

License

Open Source License

Parameter

Parameter Description
component component.

Return

component for chaining

Declaration

public static JComponent boldFont(JComponent component) 

Method Source Code


//package com.java2s;
// the terms of the GNU General Public License as published by the Free Software Foundation;

import javax.swing.*;

import java.awt.*;

public class Main {
    /**/*  w  w  w .  j  a  v a 2s .  c om*/
     * Updates a font in a component to be bold.
     *
     * @param component component.
     *
     * @return component for chaining
     */
    public static JComponent boldFont(JComponent component) {
        if (component == null)
            return null;

        component.setFont(component.getFont().deriveFont(Font.BOLD));
        return component;
    }
}

Related

  1. addLabel(Container component, String text, Icon icon, int horizontalAlignment, Font font)
  2. applyComponentFont(JComponent c)
  3. applyFont(JPanel p)
  4. applyProperties(final Component comp, final Color colBack, final Color colFore, final Font font)
  5. autoAwesomeLookAndFeel(String fontName, Map defaults)
  6. clipText(JComponent c, Font fnt, String val, int xFrom, int xTo)
  7. createTextAttributes(Font baseFont, Color color, boolean bold, boolean italic)
  8. createTextLayout(JComponent c, String s, Font f, FontRenderContext frc)
  9. defaultFont()