Example usage for java.awt Component addNotify

List of usage examples for java.awt Component addNotify

Introduction

In this page you can find the example usage for java.awt Component addNotify.

Prototype

public void addNotify() 

Source Link

Document

Makes this Component displayable by connecting it to a native screen resource.

Usage

From source file:pl.edu.icm.visnow.lib.utils.ImageUtilities.java

public static void centerComponentToContainer(Component component, Component container) {
    if (container.isDisplayable() == false) {
        container.addNotify();
    }/*from w w w.j a  v  a  2  s.co m*/
    component.setLocation((container.getWidth() - component.getWidth()) / 2,
            (container.getHeight() - component.getHeight()) / 2);
}