//Real time grafic selector 

import java.lang.Integer;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import java.util.Locale;
import java.text.*;
import java.io.*;
import java.awt.*;
import java.util.*;
import javax.swing.table.*;
import visad.*;
import visad.java3d.DisplayImplJ3D;
import visad.java2d.DisplayImplJ2D;
import java.rmi.RemoteException;

public class RTGraphP extends JPanel implements ItemListener,ActionListener,Serializable
{
  Color bg;
  final static String say1 = "2 D Plot y=f(x)";
  final static String say2 = "3 D Plot z=fx,y)";
  final static String say3 = "3 D Contour plot z=f(x,y)";
  final static String say4 = "3 D time plot y=f(x,t)";
  JPanel panel1;
  JPanel girisPaneli;	  
  //Border b=BorderFactory.createRaisedBevelBorder();
  JToggleButton l1[]=new JToggleButton[4];           //

    public RTGraphP()
    {         
      panel1 = new JPanel();
      girisPaneli=new JPanel();
      girisPaneli.setLayout(new GridLayout(4,1));
      l1[0]=new JToggleButton(say1);
      l1[1]=new JToggleButton(say2);
      l1[2]=new JToggleButton(say3);
      l1[3]=new JToggleButton(say4);
      girisPaneli.add(l1[0]);
      girisPaneli.add(l1[1]);
      girisPaneli.add(l1[2]);
      girisPaneli.add(l1[3]); 
      panel1.add(girisPaneli,BorderLayout.SOUTH);
      l1[0].addActionListener(this);
      l1[1].addActionListener(this);
      l1[2].addActionListener(this);
      l1[3].addActionListener(this); 
      add(panel1);  
    }

    public void itemStateChanged(ItemEvent e)
    {     
	 repaint();
    }
    
    public void actionPerformed(ActionEvent e) 
    {
    //Double valXmin=new Double(inputXmin.getText());
    if(e.getSource()==l1[0])
    {
	   ce1 x0=new ce1();
       double a[]=Text.readDoubleV("Fonksiyonun minimum ve maksimum dešerlerini giriniz xmin xmax");
       ce3 x1=new ce3(a[0],a[1],400,x0.s);
 
    }
    else if(e.getSource()==l1[1])
    {
       ce5 xx=new ce5();
	   double a[]=Text.readDoubleV("x_min x_max y_min y_max (4 dešer giriniz)");
	   try{
	   try{
	   ce6 xy=new ce6(a[0],a[1],a[2],a[3],200);
         } catch(RemoteException re){};
          }
          catch(VisADException ve){};
    }
    else if(e.getSource()==l1[2])
    {
    	ce1DC x0=new ce1DC();
        double a[]=Text.readDoubleV("Fonksiyonun minimum ve maksimum dešerlerini giriniz xmin xmax  ymin ymax");
        ce3DC x1=new ce3DC(a,50,x0.s);  
    }
    else if(e.getSource()==l1[3])
    {
    	ce1DT x0=new ce1DT();
        double a[]=Text.readDoubleV("Fonksiyonun minimum ve maksimum dešerlerini giriniz : xmin xmax tmin tmax");
        ce3DT x1=new ce3DT(a,x0.s);  
    }
   }  

                    
 }

