Example usage for java.awt Panel validate

List of usage examples for java.awt Panel validate

Introduction

In this page you can find the example usage for java.awt Panel validate.

Prototype

public void validate() 

Source Link

Document

Validates this container and all of its subcomponents.

Usage

From source file:ControlQueryPApplet.java

/***************************************************************************
 * Respond to ControllerEvents from the Player that was created. For the
 * bare bones player the only event of import is the RealizeCompleteEvent.
 * At that stage the visual component and controller for the Player can
 * finally be obtained and thus displayed.
 **************************************************************************/
public synchronized void controllerUpdate(ControllerEvent e) {

    if (e instanceof RealizeCompleteEvent) {
        Control[] allControls = player.getControls();
        System.out.println("" + allControls.length + " controls for a Player @ REALIZED:");
        for (int i = 0; i < allControls.length; i++)
            System.out.println("" + (i + 1) + ": " + allControls[i]);
        add(player.getVisualComponent(), "North");
        add(player.getControlPanelComponent(), "South");
        validate();/*from www .j a v  a2  s.co m*/
    } else if (e instanceof StartEvent) {
        Control[] allControls = player.getControls();
        System.out.println("" + allControls.length + " controls for a Player @ START:");
        Panel panel = new Panel();
        for (int i = 0; i < allControls.length; i++) {
            System.out.println("" + (i + 1) + ": " + allControls[i]);
            Component cont = allControls[i].getControlComponent();
            if (cont != null) {
                System.out.println("Has a graphical component");
                panel.add(cont);
            }
        }
        panel.validate();
        add(panel, "Center");
        validate();
        FrameGrabbingControl frameControl = (FrameGrabbingControl) player
                .getControl("javax.media.control.FrameGrabbingControl");
        if (frameControl == null)
            System.out.println("Unable to obtain FrameRateControl");
        else {
            System.out.println("Have Frame Rate control");
            panel.add(frameControl.getControlComponent());
            panel.validate();
        }

    }

}