

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

package source;

import java.awt.*;
import java.awt.event.*;
import javax.swing.JFrame;

public class PopUpForModuleSelect extends JFrame
{
	Container pane = getContentPane();
	SetToolPanel2 setToolPanel2;
	
	String windowName = "TOOLSET";	
	
	Control control;
	Select select;
		
	PopUpForModuleSelect(Control control, Select select, String inJapanese[], int option, int panelID, String windowTitle)
	{
		super(windowTitle);
		pane.setLayout(new BorderLayout());
        
        int X,Y,width,height;
		
        Point position = control.getLocationOnScreen();
        X=(int)position.getX();
        Y=(int)position.getY()+50;
        width = control.getWidth();
        height = control.getHeight()-50;
        
		setBounds(X, Y, width, height);
//        setBounds(0, 0, 2000, 1000);
		
		if(option == 0)
			windowName += (panelID+"NAME");
		else if(option == 1)
			windowName += (panelID+"IMAGE");
		
		this.control = control;
		this.select = select;		
				
		
        WINDOWACTIONLOG windowActionLog = new WINDOWACTIONLOG(this, windowName);
        this.addComponentListener(windowActionLog.componentListener);                    //FOR LOG
        this.addWindowListener(new MyWindowListener());
		
        setAlwaysOnTop(true);
        
		pane.setBackground(Color.white);
//		setUndecorated(true);//TEST
		
		setToolPanel2 = new SetToolPanel2(control, this, select, inJapanese, option);
        pane.add(setToolPanel2);
		setVisible(true);
	}
	
	public void setMenu()
	{
		setToolPanel2.setMenu();
	}
	
	class MyWindowListener extends WindowAdapter {
		
		public void windowClosing(WindowEvent e) // x button
		{
			setToolPanel2.closeWindows();
		}		
		
		public void windowClosed(WindowEvent e) 
		{
			if(setToolPanel2.cancel == false)
				control.savePanelInformation();			
		}
	}	
}
