Java Swing Font Change changeFontStyle(Font font, int style)

Here you can find the source of changeFontStyle(Font font, int style)

Description

change Font Style

License

Open Source License

Declaration

public static Font changeFontStyle(Font font, int style) 

Method Source Code

//package com.java2s;

import java.awt.Font;

import javax.swing.JComponent;

public class Main {
    public static Font changeFontStyle(Font font, int style) {
        return new Font(font.getName(), style, font.getSize());
    }//from ww w  .  j  a v a2  s.  co  m

    public static void changeFontStyle(JComponent component, int style) {
        component.setFont(changeFontStyle(component.getFont(), style));
    }
}

Related

  1. changeDefaultFontSize(int fontSize)
  2. changeFont(JComponent comp, double scaleFactor, int style)
  3. ChangeFont(JComponent comp, int wheel_rotation)
  4. changeFontSize(final int size)
  5. changeFontSize(Font font, float factor)
  6. changeFontToItalic(final JComponent component)
  7. installFont(Component c, Font font)
  8. installFont(Component c, Font font)