Sub Window(CustomComponent ) can't open when button click

hii all, i’ve try to starting develope web application using vaadin. when i try to create CustomComponent then show it when i click the button, the window i’ve create using extends CustomComponent can’t showing. anyone help me? this my code:

the SubWindows Classs

package com.example.hellovaadin;

import com.vaadin.annotations.AutoGenerated;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

public class SubWindows extends CustomComponent {
	Window subwindow;

    public void SubwindowExample() {

        // Create the window
        subwindow = new Window("A subwindow");

        // Configure the windws layout; by default a VerticalLayout
        VerticalLayout layout = (VerticalLayout) subwindow.getContent();

        // Add some content; a label and a close-button
        Label message = new Label("This is a subwindow");

        Button close = new Button("Close", new Button.ClickListener() {
            // inline click-listener
            public void buttonClick(ClickEvent event) {
                // close the window by removing it from the parent window
        // The components added to the window are actually added to the window's
        // layout; you can use either. Alignments are set using the layout
        layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

        // Add a button for opening the subwindow
        Button open = new Button("Open subwindow", new Button.ClickListener() {
            // inline click-listener
            public void buttonClick(ClickEvent event) {
                if (subwindow.getParent() != null) {
                    // window is already showing
                    getWindow().showNotification("Window is already open");
                } else {
                    // Open the subwindow by adding it to the parent window



	private AbsoluteLayout mainLayout;

	 * The constructor should first build the main layout, set the
	 * composition root and then do any custom initialization.
	 * The constructor will not be automatically regenerated by the
	 * visual editor.
	public SubWindows() {

		// TODO add user code here

	private void buildMainLayout() {
		// the main layout and components will be created here
		mainLayout = new AbsoluteLayout();


then on main class i create button by this code:

Button testButton = new Button();
		testButton.setDescription("sub window tes");
		testButton.setCaption("sub window tes");
		testButton.addListener(new Button.ClickListener() {
			public void buttonClick(ClickEvent event) {
				SubWindows sub = new SubWindows();

		VerticalLayout verLayout = new VerticalLayout();


thanks for advice

SOLVED, i just change


with this right method: