Here you can find the source of enableAllComponents(final boolean enable, final Frame parent)
Parameter | Description |
---|---|
enable | a parameter |
parent | a parameter |
public static void enableAllComponents(final boolean enable, final Frame parent)
//package com.java2s; //License from project: Apache License import java.awt.Component; import java.awt.Frame; import javax.swing.JDialog; public class Main { /**//from w w w. j av a 2 s.c o m * Enables/Disables all the components of a Frame based on the input. * * @param enable * @param parent */ public static void enableAllComponents(final boolean enable, final Frame parent) { if (null != parent) { Component[] components = parent.getComponents(); if (null == components) { return; } if (components.length <= 0) { return; } for (Component component : components) { if (null != component) { component.setEnabled(enable); } } } } /** * Enables/Disables all the components of a Frame based on the input. * * @param enable * @param parent */ public static void enableAllComponents(final boolean enable, final JDialog parent) { if (null != parent) { Component[] components = parent.getRootPane().getComponents(); if (null == components) { return; } if (components.length <= 0) { return; } for (Component component : components) { if (null != component) { component.setEnabled(enable); } } } } }