/*
 * Copyright (c) 2002-2007 TeamDev Ltd. All rights reserved.
 *
 * Use is subject to license terms.
 *
 * The complete licence text can be found at
 * http://www.jniwrapper.com/pages/macpack/license
 */
package com.jniwrapper.macosx.samples.demo;

import com.jniwrapper.samples.shell.components.LazyPanel;
import com.jniwrapper.samples.shell.components.HTMLText;
import com.jniwrapper.macosx.samples.TransparentNativeWindow;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Window;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 @author Vadim Steshenko
 */
public class NativeWindowSample extends LazyPanel implements ActionListener
{
    private JLabel lblAdvisoryText;
    private JButton btnShowWindow;

    public NativeWindowSample(Window parent)
    {
        super(parent);
    }

    public void initialize() throws Exception
    {
        lblAdvisoryText = new HTMLText("This sample demonstrates Native Window.");
        btnShowWindow = new JButton("Show Window");

        setLayout(new GridBagLayout());

        add(lblAdvisoryText, new GridBagConstraints(00110.00.0,
                GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10101010)00));
        add(btnShowWindow, new GridBagConstraints(02110.00.0,
                GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(20000)00));
        add(new JPanel()new GridBagConstraints(03111.01.0,
                GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0000)00));

        btnShowWindow.addActionListener(this);

        super.initialize();
    }

    public void actionPerformed(ActionEvent e)
    {
        TransparentNativeWindow window = new TransparentNativeWindow();
        window.run();
    }
}