Java Swing Menu applyContextMenuFontRecurse(MenuElement item, Font font)

Here you can find the source of applyContextMenuFontRecurse(MenuElement item, Font font)

Description

apply Context Menu Font Recurse

License

Open Source License

Declaration

public static void applyContextMenuFontRecurse(MenuElement item, Font font) 

Method Source Code


//package com.java2s;
/*//from ww w  .j  a v a  2s. c  o m
 * Misc.cs
 * Copyright ? 2008-2011 kbinani
 *
 * This file is part of org.kbinani.apputil.
 *
 * org.kbinani.apputil is free software; you can redistribute it and/or
 * modify it under the terms of the BSD License.
 *
 * org.kbinani.apputil is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

import java.awt.*;

import javax.swing.*;

public class Main {
    public static boolean isApplyFontRecurseEnabled = true;

    public static void applyContextMenuFontRecurse(MenuElement item, Font font) {
        if (!isApplyFontRecurseEnabled) {
            return;
        }

        applyToolStripFontRecurse(item, font);
    }

    public static void applyToolStripFontRecurse(MenuElement item, Font font) {
        if (!isApplyFontRecurseEnabled) {
            return;
        }

        if (item instanceof Component) {
            ((Component) item).setFont(font);
        }

        for (MenuElement element : item.getSubElements()) {
            applyToolStripFontRecurse(element, font);
        }
    }
}

Related

  1. addBooleanActionTo(Container menuOrToolBar, Action action)
  2. addHoverEffect4MenuAbout(final Component component, final Color overbgcolor, final Color overfgcolor, final Color outbgcolor, final Color outfgcolor)
  3. addRCMenuMouseListener(final JTextComponent text)
  4. appendMenuSubElements(MenuElement element, StringBuilder builder, String indent)
  5. buildManualsMenu(File appDir)
  6. constructViewMenu(ActionListener act, boolean showUMLOption, boolean showShortenedSourceOption, boolean showJavadocsOption, boolean showSourceOption)
  7. createActionMenu(JTextComponent text, boolean includeModifying)
  8. createMenu(final String label, final String mnemonic, final String accessibleDescription)