

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

package source.GameMode;

import source.*;
import source.TextData.*;
import source.GameMode.*;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import java.io.File;
import java.io.FileWriter;

import java.awt.Graphics2D;

import java.util.Timer;

	
public class ExpPanel extends JPanel implements MouseListener,ActionListener//,MouseListener, MouseMotionListener
	{
		Control control;
		ShopPanel shoppanel;
		CharacterPanel characterpanel;
		ExpData expdata;
		int fontSize = 16;
		//CharacterPanel2 characterpanel2;
		//SakuraPanel sakurapanel;
		//SuteraPanel suterapanel;
		//ShijimaPanel shijimapanel;
		//RikoPanel rikopanel;
		//SugayamaPanel sugayamapanel;
		//HEIGHT = 65		
		
		//For objects operation
//		int mouseX, mouseY;			//Coordinates for a mouse		

		Toolkit tk;
	
		Image smallImagecoin;
		Image smallImagemokume;
	
		Image smallramp;
		
		Image smallimage[];
	
	
		StatusPanel statusPanel;
		JPanel buttonBasePanel;
		JPanel buttonPanel;
		static JToggleButton item;
		static JToggleButton shop;
		static JToggleButton character = new JToggleButton();;
		static JToggleButton mission;
		static JToggleButton title;
		static JToggleButton data;
		ImageIcon icon, smallIcon;
		Image smallImg;	
		String str = "";
		String str2 = "";		
		
		static PopUpForItem popForItem;
		static PopUpForShop popForShop;
		static PopUpForCharacter popForCharacter;
		static PopUpForMission popForMission;
		static PopUpForTitle popForTitle;
		static PopUpForData popForData;
		
		int q = 255;
		int r=0,g=0,b=0;
		
		JLabel dummyLabel;
		
		int exp1 = 0;
		
		String menuInJapanese[];
		
		//SettingData settingData;
		//Thread myth;
		
		//PopUpForDoubleCheck popForDoubleCheck;
		
		String imagePath;
		
		public ExpPanel(Control control)
		{		
			setLayout(new GridLayout(1,2));			
			
			this.control = control;
			
			Image[] image = new Image[100];
			
			imagePath = control.absolutePath+"source"+File.separator+"GameMode"+File.separator+"image"+File.separator;
			
			tk = getToolkit();
			smallImagecoin = tk.getImage(imagePath+"coin.png");
			smallImagemokume = tk.getImage(imagePath+"mokume.png");
			smallramp = tk.getImage(imagePath+"ramp.png");
			
			smallimage = new Image[CharacterData.TotalCostumeNumber];
			int i2 = 0;
			int i3 = 0;
			
			for(int i = 0; i< CharacterData.TotalCostumeNumber; i++){
			smallimage[i] = tk.getImage(imagePath+ CharacterData.charaname[i2] + File.separator +  CharacterData.charaname[i2] + "Cos" + i3 + ".png");
			if(i%4 == 3) i2++;
			i3++;
			if(i%4 == 3) i3 = 0;
			}
			
			
			menuInJapanese = FILEIO.TextFileAllReadCodeArray(new File(control.absolutePath+"source"+File.separator+"GameMode"+File.separator+"ExpPanel.txt"));
			
			
			addMouseListener(this);			//MouseListener
			//addMouseMotionListener(this);	//MouseMotionListener	
		
			statusPanel = new StatusPanel();
            		buttonBasePanel = new JPanel(new BorderLayout());
			buttonPanel = new JPanel(new GridLayout(1,6));			
			setButtonPanel();
			
			statusPanel.setBackground(new Color(209,128,71));
            		buttonBasePanel.setBackground(Color.black);
			buttonPanel.setBackground(new Color(209,128,71));			
			
			dummyLabel = new JLabel(" ");
			dummyLabel.setFont(new Font(control.sp1.fontName, Font.BOLD, 16));
			
//			if(control.sp1.isWindows != true)
	//			buttonBasePanel.add(dummyLabel,BorderLayout.NORTH);
			buttonBasePanel.add(buttonPanel);
            
			add(statusPanel);
           		add(buttonBasePanel);

		//startArrangement();
		
		}

        public static void closeAllPanel()
        {
            closePopForItem();
            closePopForShop();
            closePopForCharacter();
            closePopForTitle();
            closePopForMission();
            closePopForData();
        }
        
    
	 public static void closePopForItem()
    {
        if(popForItem != null)
        {
            popForItem.dispose();
            popForItem = null;
        }
    }
    
     public static void closePopForShop()
    {
        if(popForShop != null)
        {
            popForShop.dispose();
            popForShop = null;
        }
    }
    
    public static void closePopForCharacter()
    {
        if(popForCharacter != null)
        {
            popForCharacter.closeAllWindows();
            popForCharacter.dispose();
            popForCharacter = null;
        }
    }
    
    public static void closePopForTitle()
    {
        if(popForTitle != null)
        {
            popForTitle.dispose();
            popForTitle = null;
        }
    }
    
    public  static void closePopForMission()
    {
        if(popForMission != null)
        {
            popForMission.dispose();
            popForMission = null;
        }
    }
    
     public static void closePopForData()
    {
        if(popForData != null)
        {
            popForData.dispose();
            popForData = null;
        }
    }

		public void setButtonPanel()
		{
            int iconSize = 40;

			icon = new ImageIcon(imagePath+"item.png");
			
			smallImg = icon.getImage().getScaledInstance(iconSize, iconSize, Image.SCALE_SMOOTH);
			smallIcon = new ImageIcon(smallImg);			
			item = new JToggleButton("",smallIcon);
			
			item.setSelectedIcon(new ImageIcon(imagePath+"close2.png"));

			
			icon = new ImageIcon(imagePath+"shop.png");
			smallImg = icon.getImage().getScaledInstance(iconSize, iconSize, Image.SCALE_SMOOTH);
			smallIcon = new ImageIcon(smallImg);			
			shop = new JToggleButton("",smallIcon);
			shop.setSelectedIcon(new ImageIcon(imagePath+"close2.png"));
			
			icon = new ImageIcon(imagePath+"character3.png");
			smallImg = icon.getImage().getScaledInstance(iconSize, iconSize, Image.SCALE_SMOOTH);
			smallIcon = new ImageIcon(smallImg);			
			character = new JToggleButton("",smallIcon);
			character.setSelectedIcon(new ImageIcon(imagePath+"close2.png"));
			
			icon = new ImageIcon(imagePath+"mission.png");
			smallImg = icon.getImage().getScaledInstance(iconSize, iconSize, Image.SCALE_SMOOTH);
			smallIcon = new ImageIcon(smallImg);			
			mission = new JToggleButton("",smallIcon);
			mission.setSelectedIcon(new ImageIcon(imagePath+"close2.png"));
			
			icon = new ImageIcon(imagePath+"shougou.png");
			smallImg = icon.getImage().getScaledInstance(iconSize, iconSize, Image.SCALE_SMOOTH);
			smallIcon = new ImageIcon(smallImg);			
			title = new JToggleButton("",smallIcon);
			title.setSelectedIcon(new ImageIcon(imagePath+"close2.png"));
			
			icon = new ImageIcon(imagePath+"data.png");
			smallImg = icon.getImage().getScaledInstance(iconSize, iconSize, Image.SCALE_SMOOTH);
			smallIcon = new ImageIcon(smallImg);			
			data = new JToggleButton("",smallIcon);			
			data.setSelectedIcon(new ImageIcon(imagePath+"close2.png"));
			

			if(control.sp1.inJapanese)
			{
			item.setText(menuInJapanese[0]);
			shop.setText(menuInJapanese[1]);
			character.setText(menuInJapanese[2]);
			mission.setText(menuInJapanese[3]);
			title.setText(menuInJapanese[4]);
			data.setText(menuInJapanese[5]);
			}
			else
			{
			item.setText("Item");
			shop.setText("Shop");
			character.setText("Character");
			mission.setText("Mission");
			title.setText("Skill");
			data.setText("Data");
			}
			
			item.setBackground(Color.WHITE);
			shop.setBackground(Color.WHITE);
			character.setBackground(Color.WHITE);
			mission.setBackground(Color.WHITE);
			title.setBackground(Color.WHITE);
			data.setBackground(Color.WHITE);
			
			item.addActionListener(this);
			shop.addActionListener(this);
			character.addActionListener(this);
			mission.addActionListener(this);
			title.addActionListener(this);
			data.addActionListener(this);
		
			buttonPanel.add(item);
			buttonPanel.add(shop);
			buttonPanel.add(character);
			buttonPanel.add(mission);
			buttonPanel.add(title);
			buttonPanel.add(data);
		}
		
		//Action listener
		public void actionPerformed(ActionEvent e)
		{
		
		if(e.getSource() == item){
	
		control.ex1.save();
		repaint();
		
		
		if(item.isSelected())
			{
				int x,y,width;
				x = width = getWidth();
				y = getHeight();
				if(x > 950)
                  		  x = 950;
				    if(y > 900)
                 		   y = 900;
				
				Point position = getLocationOnScreen();
				popForItem = new PopUpForItem(0,100, 400, 400, control);
				//popForItem = new PopUpForItem(control.sp1,0, (int)position.getY(), 400, 400,control);
				
				//			writeActionLog("OPEN-MODULE-SUPPORT-WINDOW");
			}
			else
			{
			closePopForItem();
			}
		
		
		}
		
		if(e.getSource() == shop){
	
		control.ex1.save();
		repaint();
		
		if(shop.isSelected())
			{
			int x,y,width;
				x = width = getWidth();
				y = getHeight();
				if(x > 950)
                  		  x = 950;
				    if(y > 900)
                 		   y = 900;
			
			
				popForShop = new PopUpForShop(100,100, 500, 400, control);
			}
			else
			{
			closePopForShop();
			//shoppanel.closePopForDoubleCheck();
			}
		
		}
		
		if(e.getSource() == character){
	
		control.ex1.save();
		repaint();
		
		if(character.isSelected())
			{
				popForCharacter = new PopUpForCharacter(200,100, 400, 400, control);
			}
			else
			{
			closePopForCharacter();
			characterpanel.closePopForCharacter2();
			//characterpanel.closePopForSakura();
			//characterpanel.closePopForSutera();
			//characterpanel.closePopForShijima();
			//characterpanel.closePopForRiko();
			//characterpanel.closePopForSugayama();
			}
		}
		
		if(e.getSource() == mission){
		
		control.ex1.save();
		repaint();
		
		if(mission.isSelected())
			{
				popForMission = new PopUpForMission(200,100, 840, 650, control);
			}
			else
			{
			closePopForMission();
			}
		
		
		}
		
		if(e.getSource() == title){
		
		control.ex1.save();
		repaint();
	
		
		if(title.isSelected())
			{
			int x,y,width;
				x = width = getWidth();
				y = getHeight();
				if(x > 950)
                  		  x = 950;
				    if(y > 600)
                 		   y = 600;
				    
				    
				popForTitle = new PopUpForTitle((int)((width-x)/2),100, 600, 600, control);
			}
			else
			{
			closePopForTitle();
			
			}
		
		
		}
		
		if(e.getSource() == data){
		control.ex1.save();
		
		repaint();
		
		if(data.isSelected())
			{
			int x,y,width;
				x = width = getWidth();
				y = getHeight();
				if(x > 950)
                  		  x = 950;
				    if(y > 600)
                 		   y = 600;
				    
				popForData = new PopUpForData((int)((width-x)/2) + 50,100, 600, 600, control);
			
			}
			else
			{
			closePopForData();
			
			}
		
		
		
		
		}
		
		}
	
		class StatusPanel extends JPanel
		{
			BasicStroke stroke;
			int sizeX;
			int sizeY;
			
			int margin;
			
			StatusPanel()
			{	
				stroke = new BasicStroke(3.0f);
				
                margin = 0;
//				if(control.sp1.isWindows == true)
					margin = 5;
		//		else
		//			margin = 25;
			}

			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);			

				drawBackground(g2);	//Set background
			
				drawData(g2);	
				drawImage(g2);				
			}
			
			public void update(Graphics g)		//Avoid from blinking
			{
				paintComponent(g);
			}			
		
			void drawBackground(Graphics2D g2)
			{
				sizeX = getWidth();
				sizeY = getHeight();

//				g2.drawImage(smallImagemokume,0,0,sizeX,sizeY,this);				
				g2.setColor(new Color(209,128,71));
				g2.fillRect(0,0,sizeX,sizeY);
				//g2.drawImage(smallImage4,0,0,sizeX,sizeY - margin,this);	
				
				//RANK
				g2.setColor(Color.pink);
				//g2.fillRoundRect(25, margin, sizeX/5+10, sizeY - 5 - margin, 5, 10);
				g2.fillRect(25, margin, sizeX/5+10, sizeY - 5 - margin);
				g2.drawImage(smallImagemokume,25, margin, sizeX/5+10, sizeY - 5 - margin,this);	
				
				//EXP
				g2.setColor(Color.orange);	
				//g2.fillRoundRect(30 + sizeX/5 + 10, margin, sizeX/5, sizeY - 5 - margin, 5, 10);
				g2.fillRect(30 + sizeX/5 + 10, margin, sizeX/5, sizeY - 5 - margin);
				g2.drawImage(smallImagemokume,30 + sizeX/5 + 10, margin, sizeX/5, sizeY - 5 - margin,this);
				
				//COIN
				g2.setColor(Color.cyan);	
				//g2.fillRoundRect(30 + 2*sizeX/5 + 20, margin, sizeX/5 - 20, sizeY - 5 - margin, 5, 10);
				g2.fillRect(30 + 2*sizeX/5 + 20, margin, sizeX/5 - 20, sizeY - 5 - margin);
				g2.drawImage(smallImagemokume,30 + 2*sizeX/5 + 20, margin, sizeX/5 - 20, sizeY - 5 - margin,this);
				
				//STAMINA	
				g2.setColor(Color.green);	
				//g2.fillRoundRect(5 + 3*sizeX/5 + 30, margin, sizeX/5 + 8 - 10, sizeY - 5 - margin, 5, 10);
				g2.fillRect(5 + 3*sizeX/5 + 30, margin, sizeX/5 + 8 - 10, sizeY - 5 - margin);
				g2.drawImage(smallImagemokume,5 + 3*sizeX/5 + 30, margin, sizeX/5 + 8 - 10, sizeY - 5 - margin,this);
				
				//NEXT RANK
				g2.setColor(new Color(0,r,g,b));
				g2.fillRoundRect(15, margin, sizeX/5+20, sizeY - 5 - margin, 5, 10);

				//g2.drawImage(smallImagemokume,0,0, sizeX, sizeY,this);
			}
		
			void drawData(Graphics2D g2)
			{
               // int fontSize = sizeY - 40;
		 int fontSize = sizeY - 15 - margin;
                if(fontSize*5 > sizeX/6)
                    fontSize = sizeX/30 -5;
                
                int centerLine = margin + (sizeY-5-margin)/2;
                
				g2.setStroke(stroke);								
				g2.setFont(new Font(control.sp1.fontName, Font.BOLD, fontSize));
			
				//RANK
				g2.setColor(Color.blue);				
				g2.drawString("RANK: "+control.ex1.rank, 35, centerLine + fontSize/2 -3);
				
				//EXP
				g2.setColor(Color.black);
				g2.drawString("EXP", 25 + sizeX/5 + 10 + 10, margin + 17);
				g2.setColor(Color.red);
				g2.fillRoundRect(25 + sizeX/5 + 10 + 10, margin + 10 + 10, ((sizeX/5 - 20) * (control.ex1.exp%100)) / 100, sizeY - 25 - margin -10, 5, 10);
				g2.setColor(Color.white);
				g2.drawRoundRect(25 + sizeX/5 + 10 + 10, margin + 10 + 10, sizeX/5 - 20, sizeY - 25 - margin -10, 5, 10);
				

				//COIN				
				g2.setColor(Color.black);				
				g2.drawImage(smallImagecoin,25 + 2*sizeX/5 + 20 + 10, centerLine - (fontSize+6)/2, fontSize+6, fontSize+6, this);
				g2.drawString(""+control.ex1.coin, 18 + 2*sizeX/5 + 20 + 10 + fontSize+ 6 + 10, centerLine + (fontSize)/2 -3);

				//STAMINA
			
				
                g2.drawString("MP", 5 + 3*sizeX/5 + 30 + 10, margin + 18);
				//g2.drawString("" + control.ex1.stamina2 +  "/" + control.ex1.stamina3,4*sizeX/5 + 55, centerLine + (fontSize)/2 + 5 );
				
				g2.setColor(Color.red);					
				g2.fillRoundRect( 3*sizeX/5 + 30 + 10, margin + 10 +10, (sizeX/5 - 20) * (int)control.ex1.stamina / 100, sizeY - 25 - margin - 10, 5, 10);
				g2.setColor(Color.white);
				g2.drawRoundRect( 3*sizeX/5 + 30 + 10, margin + 10 + 10, sizeX/5 - 20, sizeY - 25 - margin -10, 5, 10);
				
				g2.setColor(Color.black);	
				if(control.ex1.stamina2 == 100)g2.drawString("" + control.ex1.stamina2 +  "/" + control.ex1.stamina3,4*sizeX/5 - 75, centerLine + (fontSize)/2 + 5 );
				if(control.ex1.stamina2 < 100)g2.drawString("" + control.ex1.stamina2 +  "/" + control.ex1.stamina3,4*sizeX/5 - 65, centerLine + (fontSize)/2 + 5 );
				//g2.drawString("magic" ,4*sizeX/5 + 85, centerLine + (fontSize)/2 -5 );
				
				
				//MAGIC
				if(CharacterPanel2.magiccount[0] != 0 && (CharacterData.nowcharacternumber == 10 || CharacterData.nowcharacternumber == 11 || CharacterData.nowcharacternumber == 12 || CharacterData.nowcharacternumber == 13)){ 
				
				//g2.drawRoundRect(4*sizeX/5 + 35, margin, sizeY - 5 - margin,sizeY - 5 - margin, 5, 10);
				g2.drawImage(smallramp,4*sizeX/5 + 85, margin, sizeY - 5 - margin,sizeY - 5 - margin,this);
				if(CharacterPanel2.magiccount[0] >=10) g2.drawString("" + CharacterPanel2.magiccount[0],4*sizeX/5 + 92, centerLine + (fontSize)/2 -10 );
				if(CharacterPanel2.magiccount[0]<10) g2.drawString("" + CharacterPanel2.magiccount[0],4*sizeX/5 + 98, centerLine + (fontSize)/2 -10 );
				}
				else CharacterPanel2.magiccount[0] = 0;
				
				if(CharacterPanel2.magiccount[1] != 0 && (CharacterData.nowcharacternumber == 20 || CharacterData.nowcharacternumber == 21 || CharacterData.nowcharacternumber == 22 || CharacterData.nowcharacternumber == 23)){ 
				g2.drawImage(smallramp,4*sizeX/5 + 85, margin, sizeY - 5 - margin,sizeY - 5 - margin,this);
				if(CharacterPanel2.magiccount[1]>=10)g2.drawString("" + CharacterPanel2.magiccount[1],4*sizeX/5 + 92, centerLine + (fontSize)/2 - 10 );
				if(CharacterPanel2.magiccount[1]<10)g2.drawString("" + CharacterPanel2.magiccount[1],4*sizeX/5 + 98, centerLine + (fontSize)/2 - 10 );
				
				}
				else CharacterPanel2.magiccount[1] = 0;
				
				
				if(CharacterPanel2.magiccount[2] != 0 && (CharacterData.nowcharacternumber == 30 || CharacterData.nowcharacternumber == 31 || CharacterData.nowcharacternumber == 32 || CharacterData.nowcharacternumber == 33)){ 
				g2.drawImage(smallramp,4*sizeX/5 + 85, margin, sizeY - 5 - margin,sizeY - 5 - margin,this);
				if(CharacterPanel2.magiccount[2]>=10) g2.drawString("" + CharacterPanel2.magiccount[2],4*sizeX/5 + 92, centerLine + (fontSize)/2 - 10 );
				if(CharacterPanel2.magiccount[2]<10) g2.drawString("" + CharacterPanel2.magiccount[2],4*sizeX/5 + 98, centerLine + (fontSize)/2 - 10 );
				}
				else CharacterPanel2.magiccount[2] = 0;
				
				if(CharacterPanel2.magiccount[3] != 0 && (CharacterData.nowcharacternumber == 40 || CharacterData.nowcharacternumber == 41 || CharacterData.nowcharacternumber == 42 || CharacterData.nowcharacternumber == 43)){ 
				g2.drawImage(smallramp,4*sizeX/5 + 85, margin, sizeY - 5 - margin,sizeY - 5 - margin,this);
				if(CharacterPanel2.magiccount[3]>=10) g2.drawString("" + CharacterPanel2.magiccount[3],4*sizeX/5 + 92, centerLine + (fontSize)/2 - 10 );
				if(CharacterPanel2.magiccount[3]<10) g2.drawString("" + CharacterPanel2.magiccount[3],4*sizeX/5 + 98, centerLine + (fontSize)/2 - 10 );
				}
				else CharacterPanel2.magiccount[3] = 0;
				
				if(CharacterPanel2.magiccount[4] != 0 && (CharacterData.nowcharacternumber == 50 || CharacterData.nowcharacternumber == 51 || CharacterData.nowcharacternumber == 52 || CharacterData.nowcharacternumber == 53)){ 
				g2.drawImage(smallramp,4*sizeX/5 + 85, margin, sizeY - 5 - margin,sizeY - 5 - margin,this);
				if(CharacterPanel2.magiccount[4]>=10)g2.drawString("" + CharacterPanel2.magiccount[4],4*sizeX/5 + 92, centerLine + (fontSize)/2 - 10 );
				if(CharacterPanel2.magiccount[4]<10)g2.drawString("" + CharacterPanel2.magiccount[4],4*sizeX/5 + 98, centerLine + (fontSize)/2 - 10 );
				}
				else CharacterPanel2.magiccount[4] = 0;
				
				if(CharacterPanel2.magiccount[5] != 0 && (CharacterData.nowcharacternumber == 60 || CharacterData.nowcharacternumber == 61 || CharacterData.nowcharacternumber == 62 || CharacterData.nowcharacternumber == 63)){ 
				g2.drawImage(smallramp,4*sizeX/5 + 85, margin, sizeY - 5 - margin,sizeY - 5 - margin,this);
				if(CharacterPanel2.magiccount[5]>=10) g2.drawString("" + CharacterPanel2.magiccount[5],4*sizeX/5 + 92, centerLine + (fontSize)/2 - 10 );
				if(CharacterPanel2.magiccount[5]<10) g2.drawString("" + CharacterPanel2.magiccount[5],4*sizeX/5 + 98, centerLine + (fontSize)/2 - 10 );
				}
				else CharacterPanel2.magiccount[5] = 0;
				
				//NEXT RANK
				//fontSize = sizeY - 40;
				
				g2.setColor(Color.white);
				g2.drawString(str, 20,sizeY - 35);
				g2.drawString(str2, 20,sizeY - 10);

			}
		
			void drawImage(Graphics2D g2)
			{
			
			int j=0;
			int k=0;
			for(int i=0;i<CharacterData.TotalCostumeNumber;i++){
			if(CharacterData.nowcharacternumber == (j+1)*10 + k)g2.drawImage(smallimage[i], 35 + 4*sizeX/5, margin, sizeY - 5 - margin, sizeY - 5 - margin, this);
			if(i%4 == 3)j++;
			k++;
			if(i%4 == 3)k=0;
			}
			}
		}
		
		//MouseListener
		public void mousePressed(MouseEvent me){
		
		
		}	//Press
		public void mouseReleased(MouseEvent me){}	//Release
		public void mouseEntered(MouseEvent me){
		
		r=0;
		g=255;
		b=255;
		str = "TOTAL:" +control.ex1.exp;
		str2 = "NEXT:" + (100 - (control.ex1.exp - (control.ex1.rank-1) * 100));
		repaint();	
		}	//Enter an area
			public void mouseExited(MouseEvent me){
		r=0;
		g=0;
		b=0;
		str = "";
		str2="";
		repaint();
			
		}	//Exit an area
		
		public void mouseClicked(MouseEvent me)	//Click
		{
		}

}
