Java Swing Font Size resetUIFontSize(int size)

Here you can find the source of resetUIFontSize(int size)

Description

reset ui font size

License

Apache License

Parameter

Parameter Description
size a parameter

Declaration

public final static void resetUIFontSize(int size) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Map;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;

public class Main {
    /**/*  w w w . j  av a 2  s  . co  m*/
     * reset ui font size
     *
     * @param size
     */
    public final static void resetUIFontSize(int size) {

        for (Map.Entry<Object, Object> entry : UIManager.getDefaults().entrySet()) {
            Object key = entry.getKey();
            Object value = UIManager.get(key);
            if (value != null && value instanceof FontUIResource) {
                FontUIResource fr = (FontUIResource) value;
                FontUIResource f = new FontUIResource(fr.getFamily(), fr.getStyle(), size);
                UIManager.put(key, f);
            }
        }

    }
}

Related

  1. getSizeOfTextInComponent(String text, Font font, JComponent component)
  2. increaseFontSize(JComponent component, int offset)
  3. printDocumentMonospaced(Graphics g, Document doc, int fontSize, int pageIndex, PageFormat pageFormat, int tabSize)
  4. printDocumentMonospacedWordWrap(Graphics g, Document doc, int fontSize, int pageIndex, PageFormat pageFormat, int tabSize)
  5. resetUIFont(String name, int style, int size)
  6. ScaleLabelFontsizeAndDimension(JLabel label, int fontSize)
  7. setFontSize(JLabel label, int i)
  8. setFontSizeForComponent(JComponent component, int newFontSize)
  9. setLookAndFeel(int fontSize)