

//
// Core Program for TETDM 
// PopUpForFunnel.java Version 1.00
// Copyright(C) 2017-2018 TETDM CORE MEMBER ALL RIGHTS RESERVED.
// This program is provided under the license.
//

package source.Tutorial;

import source.*;
import source.GameMode.*;
import source.TextData.*;
import source.Utility.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.image.*;
import javax.imageio.ImageIO;


import java.awt.geom.RoundRectangle2D;

import static java.awt.BorderLayout.* ;

public class PopUpForFunnel extends JFrame implements MouseListener
{
    Container pane;
	FunnelPanel FunnelPanel;
	public int windowSizeX, windowSizeY;

    String imagePath;
    ImageIcon icon;
    public Image image;
    

		
	public PopUpForFunnel(int X, int Y, String absolutePath)
	{
        imagePath = absolutePath+"source"+ File.separator + "Tutorial" +File.separator+"image"+File.separator;
        icon = new ImageIcon(imagePath +"funnel.png");
        image = icon.getImage();

        pane = getContentPane();
		pane.setLayout(new BorderLayout());
        pane.addMouseListener(this);

		setAlwaysOnTop(true);
		setUndecorated(true);
		setVisible(true);
        
		FunnelPanel = new FunnelPanel();
        pane.add(FunnelPanel);

        try{
            GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
            DisplayMode displayMode = env.getDefaultScreenDevice().getDisplayMode();
            
            windowSizeX = displayMode.getWidth();
            windowSizeY = displayMode.getHeight();
        }
        catch(Exception e){
            windowSizeX = 1024;
            windowSizeY = 768;
        }
        
        setBounds(X-10,Y-10,100,160);
        
        JFrame.setDefaultLookAndFeelDecorated(true);
        setBackground(new Color(0,0,0,0));
	}
    ///
    public void mouseEntered(MouseEvent e)
    {
        this.dispose();
    }
    public void mouseExited(MouseEvent e){}
    public void mouseClicked(MouseEvent e){}
    public void mousePressed(MouseEvent e){}
    public void mouseReleased(MouseEvent e){}
    ///
    
	class FunnelPanel extends JPanel
	{
        int sizeX,sizeY;
        
		FunnelPanel(){}
		
        public void getLocalSize()
        {
            sizeX = getWidth();
            sizeY = getHeight();
        }
        
		public void update(Graphics g)		//Avoid from blinking
		{
			paintComponent(g);
		}
		
		public void paintComponent(Graphics g)
		{
			Graphics2D g2 = (Graphics2D)g;
			
			g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);// Anti aliasing
			g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);			
			
			getLocalSize();

            g2.drawImage(image,0,0,sizeX,sizeY,this);
        }
	}
}


