
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Ellipse2D;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;


import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.geom.Ellipse2D;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.table.AbstractTableModel;



import javax.swing.JPanel;



public class TopPanel extends JPanel
{

		StatusPanel status = new StatusPanel();
	
	   public TopPanel()
	    {
	    	split02.myArea.setText("[ INFO ]: Init GUI : OK" + "\n");
	    	
	    	DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
	    	Date date = new Date();
	    	dateFormat.format(date);
	   	
	    	split02.myArea.append(dateFormat.format(date) + "\n");
	    	
	    	
	    	this.setBackground(Color.orange);

	    	addMouseListener(new MouseAdapter() { 
	            public void mousePressed(MouseEvent me) 
	            { 
	            	StatusPanel status = new StatusPanel();
	            	status.incrementClickCount();
	            	
	            	//status.incrementClickCount();
	            	System.out.println(me); 
	            } 
	          }); 

	         

	    	
	    	repaint();
	    }
	    
	    @Override
		public void paint(Graphics g) 
		{
			Graphics2D g2d = (Graphics2D) g;
			g2d.setColor(Color.GREEN);
			g2d.fillOval(0, 0, 30, 30);
			g2d.drawOval(0, 50, 30, 30);		
			g2d.fillRect(50, 0, 30, 30);
			g2d.drawRect(50, 50, 30, 30);

			g2d.draw(new Ellipse2D.Double(0, 100, 30, 30));
		
		}
}

/********************************************************/
class StatusPanel extends JPanel 
{ 

	private JLabel posText = new JLabel("position:"); 
	private JLabel XCoord = new JLabel("0", JLabel.RIGHT); 
	private JLabel YCoord = new JLabel("0", JLabel.RIGHT); 
	private JLabel countText = new JLabel("no. of clicks"); 
	private JLabel counts = new JLabel("0", JLabel.RIGHT); 
	private JLabel dummy1 = new JLabel(); 
	private JLabel inOutText = new JLabel("mouse is in comp."); 
	private JLabel inOut = new JLabel("no", JLabel.RIGHT); 
	private JLabel dummy2 = new JLabel(); 
	private int clickCount = 0;


	public StatusPanel() 
	{
		this.setLayout(new GridLayout(3,3)); 
		this.add(posText); 
		this.add(XCoord); 
		this.add(YCoord); 
		this.add(countText); 
		this.add(counts); 
		this.add(dummy1); 
		this.add(inOutText); 
		this.add(inOut); 
		this.add(dummy2); 
	} 
		
	public void setCoordinates(int x, int y) 
	{ 
		XCoord.setText(Integer.toString(x)); 
		YCoord.setText(Integer.toString(y)); 
	} 

	public void setInOut(String str) 
	{ 
		inOut.setText(str); 
	} 

	public void incrementClickCount()
	{
		clickCount++;
		counts.setText(Integer.toString(clickCount));
	}

}


/********************************************************/

