

//
// Core Program for TETDM 
// PopUpForSquare.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;

public class PopUpForSquare extends JFrame
{
    Container pane;
	SquarePanel squarePanel;
	public int windowSizeX, windowSizeY;

    
    String imagePath;
    ImageIcon icon;
    public Image image;
    

	public PopUpForSquare(int X, int Y, int width, int height, Control control)
	{
        imagePath = control.absolutePath+"source"+ File.separator + "Tutorial" +File.separator+"image"+File.separator;
        icon = new ImageIcon(imagePath +"square.png");
        image = icon.getImage();
        

        pane = getContentPane();
        pane.setLayout(new BorderLayout());
        squarePanel = new SquarePanel();
        pane.add(squarePanel);
		
		setUndecorated(true);
		setVisible(true);
		
        setBounds(X,Y,width,height);
        
        JFrame.setDefaultLookAndFeelDecorated(true);
        setBackground(new Color(0,0,0,0));
	}
	
	class SquarePanel extends JPanel
	{
        int sizeX,sizeY;
        
		SquarePanel(){}
		
        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.setColor(Color.red);
            BasicStroke wideStroke = new BasicStroke(20f);
            g2.setStroke(wideStroke);
            g2.drawRect(0,0,sizeX,sizeY);
        }
	}
    
}


