Java Utililty Methods JLabel Font

List of utility methods to do JLabel Font

Description

The list of methods to do JLabel Font are organized into topic(s).

Method

voidbold(final JLabel label)
Apply bold font to a Jlabel.
final Font font = label.getFont();
label.setFont(font.deriveFont(font.getStyle() ^ Font.BOLD));
voidsetBold(JLabel label)
Make font of JLabel bold
label.setFont(label.getFont().deriveFont(Font.BOLD));
voidsetLabelBold(JLabel existingLabel, boolean bold)
Set the bold attribute of an existing label
Font f = existingLabel.getFont();
if (bold) {
    existingLabel.setFont(f.deriveFont(f.getStyle() ^ Font.BOLD));
} else {
    existingLabel.setFont(f.deriveFont(f.getStyle() | Font.BOLD));
voidsetLabelBold(JLabel label)
Modifica fontul de la un label si il face bold
Font oldFont = label.getFont();
label.setFont(oldFont.deriveFont(Font.BOLD));
voidsetNoBoldJLabels(Container parent)
set No Bold J Labels
for (Component comp : parent.getComponents()) {
    if (comp instanceof JLabel) {
        JLabel label = (JLabel) comp;
        Font f = label.getFont();
        label.setFont(f.deriveFont(f.getStyle() & ~Font.BOLD));
    } else if (comp instanceof Container) {
        setNoBoldJLabels((Container) comp);
JLabelunboldLabel(JLabel label)
unbold Label
Font font = label.getFont();
label.setFont(font.deriveFont(font.getStyle() & ~Font.BOLD));
return label;