Java JComponent Properties setGlassPane(JComponent comp, Component glass, boolean visible)

Here you can find the source of setGlassPane(JComponent comp, Component glass, boolean visible)

Description

set Glass Pane

License

LGPL

Declaration

public static void setGlassPane(JComponent comp, Component glass, boolean visible) 

Method Source Code

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

import java.awt.Component;
import java.awt.Container;

import javax.swing.JComponent;
import javax.swing.JDialog;

import javax.swing.JFrame;

public class Main {

    public static void setGlassPane(JComponent comp, Component glass, boolean visible) {
        Container container = comp.getTopLevelAncestor();
        if (container instanceof JFrame) {
            JFrame frame = (JFrame) container;
            frame.setGlassPane(glass);/*from   w ww.  j  ava 2  s . c om*/
        } else if (container instanceof JDialog) {
            JDialog dialog = (JDialog) container;
            dialog.setGlassPane(glass);
        } else {
            throw new RuntimeException("unsupported top level ancestor!");
        }
        glass.setVisible(visible);
    }
}

Related

  1. registerComponent(JComponent c)
  2. registerDataFlavors(JComponent component, DataFlavor... dataFlavors)
  3. resetDisplayComponent(JComponent mainComp, JComponent nonDispComp, JComponent newDispComp)
  4. setComponentEnabled(JComponent component, Boolean isEnabled)
  5. setDirty(JComponent comp, boolean isDirty)
  6. setLegendVisible(JComponent chartUI, boolean visible)
  7. setLightweightDispatcher(JComponent component)
  8. showAsOnlyVisibleChild(JComponent container, Component childToBeMadeVisible)
  9. showSplash(JComponent content, int milliseconds)