//==========================================================//
//JAVA-ARDUINO veri sistem entagrasyonu                                                             //            
// dials                                                                                                                            //
// M. Turhan Coban                                                                                                      //
//==========================================================//
import java.io.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.awt.geom.*;
import java.awt.Graphics;
public class dials extends JPanel 
{
 analogDialP tp[];
 JPanel jp;
 JPanel jp1;
 JTextArea output;
public dials(String s1,String unit,String s[],double td[],double tmin,double tmax,double teta1_rad,double teta2_rad)
{ 
  int n=td.length;
  System.out.println("n="+n);
  tp=new analogDialP[n];
  jp=new JPanel();
  jp1=new JPanel();
  jp.setLayout(new GridLayout(2,3));
 for(int i=0;i<n;i++)
 {  tp[i]=new analogDialP(s[i],unit,tmin,tmax,teta1_rad,teta2_rad,10,50);tp[i].setx(td[i]);jp.add(tp[i]);}
    String ss="";
    ss+="Monitor3\n";
    Color c=this.getBackground();
    output=new JTextArea(ss);
    output.setBackground(c);
    this.setLayout(new BorderLayout());
    add(output,BorderLayout.NORTH);
    add(jp,BorderLayout.CENTER);	
}

public  void setData(double td[])
{ int n=td.length;
  for(int i=0;i<n;i++)
  {tp[i].setx(td[i]);}
  repaint();
}
public static void main(String arg[])
{ double n1=Math.PI/2;
double n2=3.0*n1;
String st[]={" Voltage V "};
double td[]={0};
double tmin=0;
double tmax=5.0;
double tetamax=100;
double teta1_rad=Math.PI/4;
double teta2_rad=3.0*Math.PI/2.0+teta1_rad;
dials d1=new dials("Arduino analog read","Voltage V",st,td,tmin,tmax,teta1_rad,teta2_rad);
FrameGraphic.plot("Voltmetre ",d1);
}

}