Java JComponent Container getGlassPane(JComponent comp)

Here you can find the source of getGlassPane(JComponent comp)

Description

get Glass Pane

License

LGPL

Declaration

public static Component getGlassPane(JComponent comp) 

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 Component getGlassPane(JComponent comp) {
        Container container = comp.getTopLevelAncestor();
        if (container instanceof JFrame) {
            JFrame frame = (JFrame) container;
            return frame.getGlassPane();
        } else if (container instanceof JDialog) {
            JDialog dialog = (JDialog) container;
            return dialog.getGlassPane();
        } else {/*from   ww  w  .  j  ava  2 s.com*/
            throw new RuntimeException("unsupported top level ancestor!");
        }
    }
}

Related

  1. getComponentsOfType(JComponent base, Class type)
  2. getComponentState(JComponent c)
  3. getDataFlavors(JComponent component)
  4. getDeepestEmptyComponentAt(JComponent parent, Point location)
  5. getFirstChildComponentOfType(Component component, Class childComponentType)
  6. getGtkStyle(Object styleFactory, JComponent component, String regionName)
  7. getGtkStyle(Object styleFactory, JComponent component, String regionName)
  8. getInputHint(JComponent comp)
  9. getInsetBounds(JComponent comp)