Here you can find the source of updateComponentTreeUI(Component c)
updateUI()
-- that is, to initialize its UI property with the current look and feel.
Parameter | Description |
---|---|
c | UI component. |
public static void updateComponentTreeUI(Component c)
//package com.java2s; /*// w w w . j a v a2 s. c o m * Jitsi, the OpenSource Java VoIP and Instant Messaging client. * * Distributable under LGPL license. * See terms of license at gnu.org. */ import java.awt.*; import javax.swing.*; public class Main { /** * A simple minded look and feel change: ask each node in the tree * to <code>updateUI()</code> -- that is, to initialize its UI property * with the current look and feel. * * @param c UI component. */ public static void updateComponentTreeUI(Component c) { updateComponentTreeUI0(c); c.invalidate(); c.validate(); c.repaint(); } /** * Repaints UI tree recursively. * * @param c UI component. */ private static void updateComponentTreeUI0(Component c) { if (c instanceof JComponent) { JComponent jc = (JComponent) c; jc.invalidate(); jc.validate(); jc.repaint(); JPopupMenu jpm = jc.getComponentPopupMenu(); if (jpm != null && jpm.isVisible() && jpm.getInvoker() == jc) { updateComponentTreeUI(jpm); } } Component[] children = null; if (c instanceof JMenu) { children = ((JMenu) c).getMenuComponents(); } else if (c instanceof java.awt.Container) { children = ((java.awt.Container) c).getComponents(); } if (children != null) { for (int i = 0; i < children.length; i++) updateComponentTreeUI0(children[i]); } } }