//======================================================
// Numerical Analysis package in java
// Plot (Çizim ) programı
// Dr. Turhan Coban
// EGE Üniversitesi Mühendislik Fakultesi, Makina Bölümü
// turhan.coban@ege.edu.tr
// =====================================================
/*
 * Swing version.
 */
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.io.*;
import java.awt.print.PrinterJob;
import java.awt.print.*;

// Plot2D;
// PlotShapesSW;
// PlotW
// BasicWindowMonitor;
// PrintUtilities

public class PlotW extends JFrame implements ItemListener,ActionListener, MouseListener,MouseMotionListener
{
    private String s="";
	//f2 ff=new f2();
	boolean inAnApplet = true;
	BufferedReader fbilgi;
	PlotW pencere;
    final static String KONTROLPANEL1 = "Control page 1";
    final static String KONTROLPANEL2 = "Control page 2";
    final static String    PLOTPANEL = "Plot page   ";
     final static String   INFOPANEL = "Additional information about class Plot";
    Plot2D jta;
    double xi1,yi1,xi2,yi2;
    int n;
    JLabel altbar;          //writing area   
    JLabel promptXmin;      // Label prompt in Xmin field
    JLabel promptXmax;      // Label prompt in Xmax field
    JLabel promptYmin;      // Label prompt in Ymin field
    JLabel promptYmax;      // Label prompt in Ymax field
    JLabel promptLabel;     // Label prompt Plot Label
    JLabel promptXLabel;    // Label prompt Plot XLabel
    JLabel promptYLabel;    // Label prompt Plot YLabel
    JLabel promptXntic;      // Label prompt in Xmin field
    JLabel promptYntic;      // Label prompt in Xmax field
    JLabel promptXgridon;    // Label prompt in Ymin field
    JLabel promptYgridon;    // Label prompt in Ymax field
    JLabel promptXlogon;     // x axis log scale on
    JLabel     promptYlogon;     // y axis log scale on
    JLabel     pr[];
    JTextField inputXmin;    // input field Xmin
    JTextField inputXmax;    // input field Xmax
    JTextField inputYmin;    // input field Ymin
    JTextField inputYmax;    // input field Ymax
    JTextField inputLabel;   // input field Label
    JTextField inputXLabel;  // input field XLabel
    JTextField inputYLabel;  // input field YLabel
    JTextField inputXntic;   // input field xntic
    JTextField inputYntic;   // input field yntic
    JTextArea  bilgi;
    JCheckBox  inputXgridon;  // input field xgridon
    JCheckBox  inputYgridon;  // input field ygridon
    JCheckBox  inputXlogon;  // check field xlogon
    JCheckBox  inputYlogon;  // check field ylogon    
    JLabel     promptAdditionalLabel[];
    //to add additional label to the graphic window
    JTextField inputAdditionalLabel[]; 
    JTextField inputAdditionalXLabel[];
    JTextField inputAdditionalYLabel[]; 
    JTextArea  inputAdditionalArea[];  
    JButton    printButton;
    JLabel     arkarenk1;
    JButton    arkarenk2;
    JLabel     lab1[];
    JLabel     lab2[];
    JComboBox  c1[];
    JButton    col1[];
    JButton    but1[];
    JScrollPane skrolPane; 
    Color      renk1;
    Color      renk2;
    JPanel     pane2;
    JPanel     pane4;
    
    public PlotW()
    {  super("Plot");
       try{Plot pi=new Plot();plotWkur(pi); } catch(IOException e)
       {
       System.err.println("Error Opening File \n"+e.toString());
       System.exit(1);
       }        
    }
    
    public PlotW(Plot pi)
    {
    super(pi.label);
    plotWkur(pi);
    }

    public void plotWkur(Plot pi)
    {
	jta=new Plot2D(pi);
	renk2=Color.white;
    n=pi.nline;    
    lab1=new JLabel[n];
    lab2=new JLabel[6];
    c1=new JComboBox[n];
    col1=new JButton[n];
    bilgi=new JTextArea();
    promptAdditionalLabel=new JLabel[15];
    inputAdditionalLabel= new JTextField[15]; 
    inputAdditionalXLabel= new JTextField[7];
    inputAdditionalYLabel=new JTextField[7];
    arkarenk1=new JLabel("");
    arkarenk2=new JButton("Background color");
    arkarenk2.setBackground(renk2);
    pr=new JLabel[20];
    but1=new JButton[7];
    for(int i=0;i<5;i++)
    {promptAdditionalLabel[i]=new JLabel("additional label #"+i+" x,y coordinates");
    if(jta.p1.label_at_xy[i]!="")
    {
    inputAdditionalLabel[i]=new JTextField(jta.p1.label_at_xy[i]);
    inputAdditionalXLabel[i]=new JTextField(""+jta.p1.label_x[i]);
    inputAdditionalYLabel[i]=new JTextField(""+jta.p1.label_y[i]);
    }
    else
    {
    inputAdditionalLabel[i]=new JTextField("");
    inputAdditionalXLabel[i]=new JTextField("");
    inputAdditionalYLabel[i]=new JTextField("");
    }
    but1[i]=new JButton("enter additional label coordinates");
    }
    promptAdditionalLabel[5]=new JLabel("additional block label with data types at  x,y coordinates");
    if(jta.p1.skutu1[0]!="")
    {
	for(int i=0;i<5;i++)
	{ inputAdditionalLabel[i+5]=new JTextField(jta.p1.skutu1[i]);}
    inputAdditionalXLabel[5]=new JTextField(""+jta.p1.xl);
    inputAdditionalYLabel[5]=new JTextField(""+jta.p1.yl);    
    }
    else
    {
	for(int i=0;i<5;i++)
	{inputAdditionalLabel[i+5]=new JTextField("");}
    inputAdditionalXLabel[5]=new JTextField("");
    inputAdditionalYLabel[5]=new JTextField("");
    }
    but1[5]=new JButton("enter coordinates for additional labels");
    promptAdditionalLabel[6]=new JLabel("additional block label at x,y coordinates");    
    if(jta.p1.skutu2[0]!="")
    {
	for(int i=0;i<5;i++)
	{inputAdditionalLabel[i+10]=new JTextField(jta.p1.skutu2[i]);}
    inputAdditionalXLabel[6]=new JTextField(""+jta.p1.xl);
    inputAdditionalYLabel[6]=new JTextField(""+jta.p1.yl);
    }
    else
    {
	for(int i=0;i<5;i++)
	{inputAdditionalLabel[i+10]=new JTextField("");}
    inputAdditionalXLabel[6]=new JTextField("");
    inputAdditionalYLabel[6]=new JTextField("");
    }
    but1[6]=new JButton("enter coordinates for additional labels"); 
    promptAdditionalLabel[6]=new JLabel("additonal label at x,y corrdinates");
    pr[0]=new JLabel("");
    pr[1]=new JLabel("x coordinate");
    pr[2]=new JLabel("y coordinate");
    pr[3]=new JLabel("Heading");
    pr[4]=new JLabel("last clicked point");
    lab2[0]=new JLabel("");
    lab2[1]=new JLabel("line type");
    lab2[2]=new JLabel("color selection table");
    
    for(int i=0;i<n;i++)
    {
	Color color1=new Color(pi.red[i],pi.green[i],pi.blue[i]);
	lab1[i]=new JLabel("line "+i+" ");
    c1[i]=new JComboBox(pi.plotst);
    c1[i].setSelectedIndex(pi.plottype[i]);
    col1[i]=new JButton(" ");
    col1[i].setBackground(color1);
    }
    
    Container contentPane = getContentPane();
    renk1=contentPane.getBackground();
    JTabbedPane tabbedPane = new JTabbedPane();
        printButton=new JButton("print");
        promptXmin=new JLabel("Xmin ");
        inputXmin=new JTextField(10);
        promptXmax=new JLabel("Xmax ");
        inputXmax=new JTextField(10);
        promptYmin=new JLabel("Ymin ");
        inputYmin=new JTextField(10);
        promptYmax=new JLabel("Ymax ");
        inputYmax=new JTextField(10);
        //*******
        promptLabel=new  JLabel("Plot heading     : ");
        promptXLabel=new JLabel("x axis label : ");
        promptYLabel=new JLabel("y axis label : ");
        inputLabel=new JTextField(40);
        inputXLabel=new JTextField(40);
        inputYLabel=new JTextField(40);
        inputLabel.setBackground(renk1);
        inputXLabel.setBackground(renk1);
        inputYLabel.setBackground(renk1);
        //*******
        promptXntic=new JLabel("x thick no");
        inputXntic=new JTextField(10);
        promptYntic=new  JLabel("y thick no");
        inputYntic=new JTextField(10);
        
        promptXgridon=new JLabel("x grid ");
        if(pi.xgridon!=0) inputXgridon=new JCheckBox("   ",true);
        else              inputXgridon=new JCheckBox("   ",false);        
        promptYgridon=new JLabel("Y grid");
        if(pi.ygridon!=0) inputYgridon=new JCheckBox("   ",true);
        else              inputYgridon=new JCheckBox("   ",false);        
        promptXlogon=new JLabel("x log ");    
        promptYlogon=new JLabel("y log ");   
        if(pi.xlog!=0) inputXlogon=new JCheckBox("   ",true);
        else            inputXlogon=new JCheckBox("   ",false);
        if(pi.ylog!=0) inputYlogon=new JCheckBox("   ",true);
        else            inputYlogon=new JCheckBox("   ",false);
          // check field xlogon
        JPanel pane1 = new JPanel();
        JPanel pane3 = new JPanel();
        JPanel mpane=new JPanel();
        bilgi.setText(bilgioku());
        bilgi.setBackground(renk1);
        pane3.add(bilgi);
       
        mpane.setLayout(new GridLayout(6,4));
        JPanel p1=new JPanel();
        
        p1.setLayout(new GridLayout(6,5));
        JPanel p4=new JPanel();
        p4.setLayout(new GridLayout(6,5));
        JPanel p5=new JPanel();
        p5.setLayout(new GridLayout(1,5));
        JPanel p5a=new JPanel();
        p5a.setLayout(new GridLayout(6,1));
        JPanel p5b=new JPanel();
        p5b.setLayout(new BorderLayout());
        JPanel p6=new JPanel();
        p6.setLayout(new GridLayout(1,5));
        JPanel p6a=new JPanel();
        p6a.setLayout(new GridLayout(6,1));
        JPanel p6b=new JPanel();
        p6b.setLayout(new BorderLayout());
        
        mpane.add(promptXmin);
        inputXmin.setBackground(renk1);
        inputXmax.setBackground(renk1);
        inputYmin.setBackground(renk1);
        inputYmax.setBackground(renk1);
        inputXntic.setBackground(renk1);
        inputYntic.setBackground(renk1);
        mpane.add(inputXmin);
        mpane.add(promptXmax);
        mpane.add(inputXmax);
        mpane.add(promptYmin);
        mpane.add(inputYmin);
        mpane.add(promptYmax);
        mpane.add(inputYmax);
        mpane.add(promptXntic);
        mpane.add(inputXntic);
        mpane.add(promptYntic);
        mpane.add(inputYntic);
        mpane.add(promptXgridon);
        mpane.add(inputXgridon);
        mpane.add(promptYgridon);
        mpane.add(inputYgridon);
        mpane.add(promptXlogon);
        mpane.add(inputXlogon);
        mpane.add(promptYlogon);
        mpane.add(inputYlogon);
        mpane.add(arkarenk1);
        mpane.add(arkarenk2);
        JLabel bos=new JLabel("");
        mpane.add(bos); 
        mpane.add(printButton);        
        pane1.add(mpane,BorderLayout.NORTH);
        JPanel xpane=new JPanel();
        xpane.setLayout(new GridLayout((n+1),3));
        for(int i=0;i<3;i++)
        {lab2[i].setBackground(renk1);
	     xpane.add(lab2[i]);}
        
	    for(int i=0;i<n;i++)
        {   xpane.add(lab1[i]);
            xpane.add(c1[i]);
            xpane.add(col1[i]);
            c1[i].setBackground(renk1);
        }        
        
        JPanel lpane=new JPanel();
        lpane.setLayout(new GridLayout(3,2));
        lpane.add(promptLabel);
        lpane.add(inputLabel);
        lpane.add(promptXLabel);
        lpane.add(inputXLabel);
        lpane.add(promptYLabel);
        lpane.add(inputYLabel);
        //********
        p4.add(pr[0]);
        p4.add(pr[1]);
        p4.add(pr[2]);
        p4.add(pr[3]);
        p4.add(pr[4]);
        for(int i=0;i<15;i++)
        {inputAdditionalLabel[i].setBackground(renk1);}
        for(int i=0;i<7;i++)
        {
         inputAdditionalXLabel[i].setBackground(renk1);
         inputAdditionalYLabel[i].setBackground(renk1);
        } 
        for(int i=0;i<5;i++)
        {
	     p4.add(promptAdditionalLabel[i]);
         p4.add(inputAdditionalXLabel[i]);
         p4.add(inputAdditionalYLabel[i]);
         p4.add(inputAdditionalLabel[i]);
         p4.add(but1[i]);       
        }
        JLabel lx1=new JLabel("block label with plot symbol x1 coordinate");
        JLabel ly1=new JLabel("block label with plot symbol y1 coordinate");
        p5.add(lx1);
        p5.add(inputAdditionalXLabel[5]); 
        p5.add(ly1);
        p5.add(inputAdditionalYLabel[5]);
        p5.add(but1[5]);
        p5a.add(p5);
        for(int i=0;i<5;i++) {p5a.add(inputAdditionalLabel[i+5]);}       
        JLabel lx2=new JLabel("block label  x2 coordinate");
        JLabel ly2=new JLabel("block label with plot symbol y2 coordinate");
        p6.add(lx2);
        p6.add(inputAdditionalXLabel[6]); 
        p6.add(ly2);
        p6.add(inputAdditionalYLabel[6]);
        p6.add(but1[6]);
        p6a.add(p6);
        for(int i=0;i<5;i++) {p6a.add(inputAdditionalLabel[i+10]);}       

        p5b.add(p5a,BorderLayout.NORTH);
        p5b.add(p6a,BorderLayout.SOUTH);
        p6b.add(p4,BorderLayout.NORTH);
        p6b.add(p5b,BorderLayout.SOUTH);
        
        //lpane.add(p1);
        skrolPane=new JScrollPane(xpane,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        pane1.add(lpane,BorderLayout.NORTH);
        pane1.add(p1,BorderLayout.CENTER);
        pane1.add(skrolPane,BorderLayout.SOUTH);

        //*********

        for(int i=0;i<15;i++)
        {inputAdditionalLabel[i].addActionListener(this);
        }
        for(int i=0;i<n;i++)
        { c1[i].addItemListener(this);
	      col1[i].addActionListener(this);
        }        

        //**********
        for(int i=0;i<15;i++)
        {inputAdditionalLabel[i].addActionListener(this);}
        for(int i=0;i<7;i++)
        {
        inputAdditionalXLabel[i].addActionListener(this);
        inputAdditionalYLabel[i].addActionListener(this); 
        but1[i].addActionListener(this);
        }
        printButton.addActionListener(this);
        inputXmin.addActionListener(this);
        inputXmax.addActionListener(this);
        inputYmin.addActionListener(this);
        inputYmax.addActionListener(this);
        inputLabel.addActionListener(this);
        inputXLabel.addActionListener(this);
        inputYLabel.addActionListener(this);
        inputXntic.addActionListener(this);
        inputYntic.addActionListener(this);
        inputXlogon.addItemListener(this);
        inputYlogon.addItemListener(this);
        inputXgridon.addItemListener(this);
        inputYgridon.addItemListener(this);
        arkarenk2.addActionListener(this);

        inputXmin.setText(Double.toString(jta.p1.xmin));
        inputXmax.setText(Double.toString(jta.p1.xmax));
        inputYmin.setText(Double.toString(jta.p1.ymin));
        inputYmax.setText(Double.toString(jta.p1.ymax));
        inputXntic.setText(Integer.toString(jta.p1.xntic));
        inputYntic.setText(Integer.toString(jta.p1.yntic));
        inputLabel.setText(jta.p1.label);
        inputXLabel.setText(jta.p1.xlabel);
        inputYLabel.setText(jta.p1.ylabel);
      
        pane2 = new JPanel();
        pane2.setLayout(new BorderLayout());
        pane4 = new JPanel();
        pane4.setLayout(new BorderLayout());
        altbar=new JLabel();
        pane2.add(altbar,BorderLayout.SOUTH);
        pane2.addMouseListener(this);
        pane2.addMouseMotionListener(this);        
        pane2.add(jta);
        pane4.add(p6b);
        tabbedPane.addTab(PLOTPANEL,    pane2);
        tabbedPane.addTab(KONTROLPANEL1, pane1);
        tabbedPane.addTab(KONTROLPANEL2, pane4);
        tabbedPane.addTab(INFOPANEL,new JScrollPane(pane3,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
        contentPane.add(  tabbedPane, BorderLayout.CENTER);
	}
    
    public void itemStateChanged(ItemEvent e)
    {
    inputXmin.setText(Double.toString(jta.p1.xmin));
    inputXmax.setText(Double.toString(jta.p1.xmax));
    inputYmin.setText(Double.toString(jta.p1.ymin));
    inputYmax.setText(Double.toString(jta.p1.ymax));
    inputXntic.setText(Integer.toString(jta.p1.xntic));
    inputYntic.setText(Integer.toString(jta.p1.yntic));
    Object source=e.getItemSelectable();
    
    if(source==inputXgridon)
    {
        if (e.getStateChange() == ItemEvent.DESELECTED)
        {jta.p1.xgridon=0;}
        else
        {jta.p1.xgridon=1;}
    }
    else if(source==inputYgridon)
    {
        if (e.getStateChange() == ItemEvent.DESELECTED)
        {jta.p1.ygridon=0;}
        else
        {jta.p1.ygridon=1;}
    }
    else if(source==inputXlogon)
    {
        if (e.getStateChange() == ItemEvent.DESELECTED)
        {jta.p1.setXlogScaleOff();}
        else
        {jta.p1.setXlogScaleOn();}
    }
    else if(source==inputYlogon)
    {
       if (e.getStateChange() == ItemEvent.DESELECTED)
       {jta.p1.setYlogScaleOff();}
       else
       {jta.p1.setYlogScaleOn();}
    }
    else
    {
    for(int i=0;i<n;i++)
    {   if(source==c1[i])
	    {jta.p1.plottype[i]=c1[i].getSelectedIndex();
	    	     if(jta.p1.plottype[i] == 10) jta.p1.ch[i]='\u2295';//you can change character set by using setPlotType(0,'%');
         if(jta.p1.plottype[i] == 11) jta.p1.ch[i]='\u2297';
         if(jta.p1.plottype[i] == 12) jta.p1.ch[i]='\u2299';
         if(jta.p1.plottype[i] == 13) jta.p1.ch[i]='\u229A';
         if(jta.p1.plottype[i] == 14) jta.p1.ch[i]='\u229B';
         if(jta.p1.plottype[i] == 15) jta.p1.ch[i]='\u229E';
         if(jta.p1.plottype[i] == 16) jta.p1.ch[i]='\u22A0';
         if(jta.p1.plottype[i] == 17) jta.p1.ch[i]='\u22A1';
         if(jta.p1.plottype[i] == 18) jta.p1.ch[i]='\u22B9';
         if(jta.p1.plottype[i] == 19) jta.p1.ch[i]='\u22C7';      }
    }    
    inputLabel.setText(jta.p1.label);
    inputXLabel.setText(jta.p1.xlabel);
    inputYLabel.setText(jta.p1.ylabel);
    jta.yenidenciz();
    }
}
    public void actionPerformed(ActionEvent e)
    {
     if(e.getSource()==printButton)
	 {
     PrintUtilities.printComponent(pane2);
     }
    if (e.getSource()==inputXmin )
    {Double valXmin=new Double(inputXmin.getText());
    jta.p1.xmin=valXmin.doubleValue();}    
    else if (e.getSource()==inputXmax )
    {Double valXmax=new Double(inputXmax.getText());
    jta.p1.xmax=valXmax.doubleValue();}    
    else if (e.getSource()==inputYmin )
    {Double valYmin=new Double(inputYmin.getText());
    jta.p1.ymin=valYmin.doubleValue();}    
    else if (e.getSource()==inputYmax )
    {Double valYmax=new Double(inputYmax.getText());
    jta.p1.ymax=valYmax.doubleValue();}
    else if (e.getSource()==inputXntic )
    {Integer valXntic=new Integer(inputXntic.getText());
    jta.p1.xntic=valXntic.intValue();}
    else if (e.getSource()==inputYntic )
    {Integer valYntic=new Integer(inputYntic.getText());
    jta.p1.yntic=valYntic.intValue();}
    else if (e.getSource()==inputLabel )
    {jta.p1.label=inputLabel.getText();}
    else if (e.getSource()==inputXLabel )
    {jta.p1.xlabel=inputXLabel.getText();}
    else if (e.getSource()==inputYLabel )
    {jta.p1.ylabel=inputYLabel.getText();}
    else if(e.getSource()==arkarenk2)
    { renk2=JColorChooser.showDialog(null,"grafik arka plan rengi ",renk2 );
      jta.setBackground(renk2);
      arkarenk2.setBackground(renk2);
    }
    String s1;
    for(int i=0;i<7;i++)
    { 
	  if(e.getSource()==but1[i])
	  { if(i<5)
	    {
		jta.p1.label_x[i]=xi2;
	    jta.p1.label_y[i]=yi2;
        }
        else if(i==5)
        {jta.p1.x1=xi2;
	     jta.p1.y1=yi2;
	    }
	    else if(i==6)
        {jta.p1.x2=xi2;
	     jta.p1.y2=yi2;
	    }
	    inputAdditionalXLabel[i].setText(""+xi2);
	    inputAdditionalYLabel[i].setText(""+yi2);
	  }

      if(e.getSource()==inputAdditionalXLabel[i])
      {s1=inputAdditionalXLabel[i].getText();
       if(i<5){
              if(s1!="") jta.p1.label_x[i]=Double.parseDouble(s1);
              else jta.p1.label_x[i]=0.0;
              }
       else if(i==5) {
	       if(s1!="") jta.p1.x1=Double.parseDouble(s1);
           else jta.p1.x1=0.0;       
              }
       else if(i==6) {
	       if(s1!="") jta.p1.x2=Double.parseDouble(s1);
           else jta.p1.x2=0.0;       
              }
      }               
      else if(e.getSource()==inputAdditionalYLabel[i])
      {s1=inputAdditionalYLabel[i].getText();
              if(i<5){
              if(s1!="") jta.p1.label_y[i]=Double.parseDouble(s1);
              else jta.p1.label_y[i]=0.0;
              }
       else if(i==5) {
	       if(s1!="") jta.p1.y1=Double.parseDouble(s1);
           else jta.p1.y1=0.0;       
              }
       else if(i==6) {
	       if(s1!="") jta.p1.y2=Double.parseDouble(s1);
           else jta.p1.y2=0.0;       
              }
      }
      }
      for(int i=0;i<15;i++)
      {
      if(e.getSource()==inputAdditionalLabel[i])
      {
       if(i<5)
       {
	   jta.p1.label_at_xy[i]=inputAdditionalLabel[i].getText();       
       s1=inputAdditionalXLabel[i].getText();       
       if(s1!="") jta.p1.label_x[i]=Double.parseDouble(s1);
       else jta.p1.label_x[i]=0.0;
       s1=inputAdditionalYLabel[i].getText();
       if(s1!="") jta.p1.label_y[i]=Double.parseDouble(s1);
       else jta.p1.label_y[i]=0.0;
       s1=jta.p1.label_at_xy[i];
       }
       else if(i>=5 && i<10)
       {	   
	   jta.p1.skutu1[i-5]=inputAdditionalLabel[i].getText();       
       s1=inputAdditionalXLabel[5].getText();       
       if(s1!="") jta.p1.x1=Double.parseDouble(s1);
       else jta.p1.x1=0.0;
       s1=inputAdditionalYLabel[5].getText();
       if(s1!="") jta.p1.y1=Double.parseDouble(s1);
       else jta.p1.y1=0.0;
       }
       else if(i>=10 && i<15)
       {   
	   jta.p1.skutu2[i-10]=inputAdditionalLabel[i].getText();       
       s1=inputAdditionalXLabel[6].getText();       
       if(s1!="") jta.p1.x2=Double.parseDouble(s1);
       else jta.p1.x2=0.0;
       s1=inputAdditionalYLabel[6].getText();
       if(s1!="") jta.p1.y2=Double.parseDouble(s1);
       else jta.p1.y2=0.0;
       }
      }
      }
    for(int i=0;i<n;i++)
    {
	Color color1=new Color(jta.p1.red[i],jta.p1.green[i],jta.p1.blue[i]);    
	Color color2;
    if (e.getSource()==col1[i] )
    { color2=JColorChooser.showDialog(null,"grafik programı eğri "+i,color1 );
    jta.p1.red[i]=color2.getRed();jta.p1.green[i]=color2.getGreen();jta.p1.blue[i]=color2.getBlue();
     col1[i].setBackground(color2);
    }
    }    
    jta.yenidenciz();
    }
    
      public void degerleriGir(String e,int x,int y)
      {
      s=e;
      if(jta.p1.xlog!=0)
      {xi1=jta.p1.xmin+Math.pow(10.0,(double)((x-jta.p1.xabsmin)/(double)jta.p1.abswidth*(double)jta.p1.xminmaxlog+1.0))-10.0; }
      else
      {xi1=jta.p1.xmin+(double)(x-jta.p1.xabsmin)/(double)jta.p1.abswidth*(jta.p1.xmax-jta.p1.xmin);}
      if(jta.p1.ylog!=0)
      {yi1=jta.p1.ymin-10.0+Math.pow(10.0,((double)(1.0-(double)(y-jta.p1.yabsmin-jta.p1.absheight)/(double)jta.p1.absheight*(double)jta.p1.yminmaxlog))); }
      else
      {yi1=jta.p1.ymin-(double)(y-jta.p1.yabsmin-jta.p1.absheight)/(double)jta.p1.absheight*(jta.p1.ymax-jta.p1.ymin);}
      altbar.setText(e+" ["+xi1+" , "+yi1+"] ");
      //jta.yenidenciz();
      }
      
      public void degerleriGir1(String e,int x,int y)
      {
      s=e;
      if(jta.p1.xlog!=0)
      {xi2=jta.p1.xmin+Math.pow(10.0,(double)((x-jta.p1.xabsmin)/(double)jta.p1.abswidth*(double)jta.p1.xminmaxlog+1.0))-10.0; }
      else
      {xi2=jta.p1.xmin+(double)(x-jta.p1.xabsmin)/(double)jta.p1.abswidth*(jta.p1.xmax-jta.p1.xmin);}
      if(jta.p1.ylog!=0)
      {yi2=jta.p1.ymin-10.0+Math.pow(10.0,((double)(1.0-(double)(y-jta.p1.yabsmin-jta.p1.absheight)/(double)jta.p1.absheight*(double)jta.p1.yminmaxlog))); }
      else
      {yi2=jta.p1.ymin-(double)(y-jta.p1.yabsmin-jta.p1.absheight)/(double)jta.p1.absheight*(jta.p1.ymax-jta.p1.ymin);}
      //System.out.println(""+xi2+" "+yi2);
      }
      
      public void mousePressed(MouseEvent e)
      {  if(e.isMetaDown()) {degerleriGir1("Fare değerleri kaydedildi",e.getX(),e.getY());} //sağ tuş basıldığında
         else if(e.isAltDown())             //orta tuş basıldığında
             {} 
         else { degerleriGir1("Mouse values are recorded",e.getX(),e.getY());}  //sol tuş basıldığında
      }
      
      public void mouseClicked(MouseEvent e)
      { degerleriGir1("Kliklendi",e.getX(),e.getY()); }

      public void mouseReleased(MouseEvent e)
      { degerleriGir1("mouse released",e.getX(),e.getY()); }

      public void mouseEntered(MouseEvent e)
      { setTitle("mouse entered to plot window"); }

      public void mouseExited(MouseEvent e)
      { setTitle("mouse exited from the plot window");
        degerleriGir("mouse is outside of the plot window",e.getX(),e.getY());
      }
      //MouseMotionListener (fare hareket dinleyicisi) metotlari

      public void mouseDragged(MouseEvent e)
      { degerleriGir("mouse dragged",e.getX(),e.getY()); }

      public void mouseMoved(MouseEvent e)
      { degerleriGir("x, y coordinates:",e.getX(),e.getY()); }      
 
      public void plot()
      {
	  //takes plot sata from Plot.txt file    
      pencere= new PlotW();
      pencere.addWindowListener(new BasicWindowMonitor());
      pencere.setSize(1000,700);
      pencere.setVisible(true);
      pencere.setDefaultCloseOperation(pencere.DISPOSE_ON_CLOSE);
      } 
      
           
      public void plot(Plot pi)
      {
      //take plot data from pi object
	  pencere= new PlotW(pi);
      pencere.addWindowListener(new BasicWindowMonitor());
      pencere.setSize(1000,700);
      pencere.setVisible(true);
      pencere.setDefaultCloseOperation(pencere.DISPOSE_ON_CLOSE);
      }
      
      protected void close(){pencere.close();}
      
      public static void main(String[] args)
      {
      PlotW pencere1= new PlotW();
      pencere1.addWindowListener(new BasicWindowMonitor());
      pencere1.setSize(1000,700);
      pencere1.setVisible(true);
      pencere1.setDefaultCloseOperation(pencere1.DISPOSE_ON_CLOSE);
      }
      
      public String bilgioku()  
      {String s;
s= " 1.6.13 JAVA 2 DIMENSIONAL GRAPHIC OUTPUT CLASS : PLOT   \n ";
s+=" 2 dimensional scientific plot program to be \n";
s+= "======================================================  \n ";
s+= " Plot program aims a simple yet sophisticated set of plots  \n ";
s+= " to be drawn for two dimensional engineering plot applications.\n";
s+= " Seeing the data is always easier for evaluating the results.\n";
s+= " There are commercially available plot programs, but the purpose of\n";
s+= " this package is to create an absolutely free and open code supporting plot\n";
s+= " definitions. Most of the subprograms in the package is add on methods from \n";
s+= " the actual requirements arised in numerical analysis and engineering applications \n";
s+= " If you would like to add into the package you are welcome, but please send me the \n";
s+= " add ups, if they will be usefull, I can make them permanent in the package \n";
s+= " my current email : turhan_coban@yahoo.com. Have a happy plotting\n"; 
s+= "======================================================  \n ";
s+= "Program 1.6.13-1 PlotT1.java SAMPLE PROGRAM  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT1  \n ";
s+= "{  public static void main(String args[]) throws IOException  \n ";
s+= "  {Plot pp=new Plot(\"in.txt\");  \n ";
s+= "   pp.plot();}}  \n ";
s+= "  \n ";
s+= "Our first example code reads data from file in.txt and plot it  \n ";
s+= "The first line is the constructor line     \n ";
s+= "Plot pp=new Plot(\"in.txt\"); it inputs data from file in.txt and   pp.plot();   \n ";
s+= "term is actually draw the plot window. This term will always be used to   \n ";
s+= "open plot window\n ";
s+= "  \n ";
s+= "In the second page of the graphic window several editing features are available\n ";
s+= "such as plot shapes, headings, colors, grid, logarithmic scale, manual maximum\n ";
s+= "and minimum x an y scales, additional heading space in any desired location \n ";
s+= "of the plot \n ";
s+= "Page can be grided into a desired size, Graphic color can be changed by using\n ";
s+= "standard java JColorChooser class graphic editor   \n ";
s+= "   \n ";
s+= "In our second example program data in file in.txt is drawn by a single static definition   \n ";
s+= "  \n ";
s+= "Program 1.6.13-1A PlotT1.java sample program  \n ";
s+= "import java.io.*;  \n ";
s+= "class plotT1  \n ";
s+= "{    \n ";
s+= "  public static void main(String args[]) throws IOException  \n ";
s+= "  {Plot.file(\"in.txt\");}  \n ";
s+= "}  \n ";
s+= "  \n ";
s+= "Static definitions are usually preferred for one step plot drawing  \n ";
s+= "If several different plot jobs will be defined, dynamic definitions    \n ";
s+= "should be preferrred. In the next example data is given inside of the program\n ";
s+= "as two double vectors  \n ";
s+= "Program 1.6.13-2  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2A  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "     double yy[]={1,4,9,16,25};  \n ";
s+= "     Plot pp=new Plot(xx,yy);  \n ";
s+= "     pp.plot();}}  \n ";
s+= "   \n ";
s+= "The static version of the same program  :  \n ";
s+= "   \n ";
s+= "Program 1.6.13-2A  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2A  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "      double yy[]={1,4,9,16,25};  \n ";
s+= "      Plot.data(xx,yy);}}  \n ";
s+= " The next program first defines the data and then add up cubic spline  \n ";
s+= " curve fittings to the given data (2 plot lines are to be drawn)  \n ";
s+= "Program 1.6.13-3  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2B  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "      double yy[]={1,4,9,16,25};  \n ";
s+= "      Plot pp=new Plot(xx,yy);  \n ";
s+= "      pp.addSpline(xx,yy,10);  \n ";
s+= "      pp.plot();}}  \n ";
s+= "  \n ";
s+= "  \n ";
s+= "In order to do Cubic spline curve fitting adding term pp.addSpline(xx,yy,10); was enough\n ";
s+= "10 additional cubic spline fit data is added in between every point\n ";
s+= " If the original curve index number is known, it can also be used to curve feet additional data \n ";
s+= " index number start from zero and goes upwards for evry new curve to be added \n ";
s+= "Program 1.6.13-3A  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2B2  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "      double yy[]={1,4,9,16,25};  \n ";
s+= "      Plot pp=new Plot(xx,yy);  \n ";
s+= "      pp.addSpline(0,10);  \n ";
s+= "      pp.plot();}}  \n ";
s+= "Static definitions can not be applied in the prot drawings with more than one command such   \n ";
s+= "as in the above program, but you can always write your user specific static method  \n ";
s+= "to collect your own group of commands\n ";
s+= "  \n ";
s+= "Program 1.6.13-3B  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2B  \n ";
s+= "{      \n ";
s+= "     public static void plot(double xx[],double yy[])  \n ";
s+= "     {Plot pp=new Plot(xx,yy);  \n ";
s+= "      pp.addSpline(xx,yy,10);  \n ";
s+= "      pp.plot();}  \n ";
s+= "        \n ";
s+= "     public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "      double yy[]={1,4,9,16,25};  \n ";
s+= "      plot(xx,yy);}}  \n ";
s+= "  \n ";
s+= "The same interpolation calculations can also be carried out by B spline\n";
s+= "interpolation with term  pp.addB_Spline(xx,yy,10);    \n ";
s+= "  \n ";
s+= "Program 1.6.13-3C  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2B1  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "      double yy[]={1,4,9,16,25};  \n ";
s+= "      Plot pp=new Plot(xx,yy);  \n ";
s+= "      pp.addB_Spline(xx,yy,10);  \n ";
s+= "      pp.plot();}}  \n ";
s+= "  \n ";
s+= " If second degree orthogonal polynomial to be used for curve fitting   \n ";
s+= " (10 data points in between original points)  \n ";
s+= "  \n ";
s+= "Program 1.6.13-4  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2C  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "      double yy[]={1,4,9,16,25};  \n ";
s+= "      Plot pp=new Plot(xx,yy);  \n ";
s+= "      pp.addOPEKK(xx,yy,2,10);  \n ";
s+= "      pp.plot();}}  \n ";
s+= "  \n ";
s+= "  \n ";
s+= "if a second degree polynomial is desired fro corve fitting (fx=a0+a1*x+a2*x2) \n";
s+= " (10 data points in between original points)  \n ";
s+= "Program 1.6.13-5  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2D  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "      double yy[]={1,4,9,16,25};  \n ";
s+= "      Plot pp=new Plot(xx,yy);  \n ";
s+= "      pp.addEKK(xx,yy,2,10);  \n ";
s+= "      pp.plot();}}  \n ";
s+= "  \n ";
s+= "  \n ";
s+= "Lagrange interpolation can also be used.  \n ";
s+= "Program 1.6.13-6  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2E  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {double xx[]={1,2,3,4,5};  \n ";
s+= "      double yy[]={1,4,9,16,25};  \n ";
s+= "      Plot pp=new Plot(xx,yy);  \n ";
s+= "      pp.addLagrange(xx,yy,10);  \n ";
s+= "      pp.plot();}}  \n ";
s+= "  \n ";
s+= "  \n ";
s+= "The detailed information about interpolation routines are given in \n ";
s+= "Numerical Analysis by using java programs text book  \n ";
s+= " \n";
s+= "Constructor in the plot program can be given as completely empty.   \n ";
s+= "Program 1.6.13-7 (Dynamic call)  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT01  \n ";
s+= "{public static void main (String args[]) throws IOException  \n ";
s+= "  {Plot pp=new Plot();  \n ";
s+= "   pp.plot();}}  \n ";
s+= "  \n ";
s+= "Program 1.6.13-7A (Static call)  \n ";
s+= "import java.io.*;  \n ";
s+= "class PlotT2B1  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {Plot.file();}}  \n ";
s+= "  \n ";
s+= "In this case program will look the data file  Plot.txt for data.\n ";
s+= "Data is given in the following form in this data\n ";
s+= "Plot label         \n ";
s+= "x axis label  \n ";
s+= "y axis label        \n ";
s+= "2   \n ";
s+= "in.txt  0 0 0 0    \n ";
s+= "out.txt 3 0 0 255   \n ";
s+= "  \n ";
s+= "The meaning of this data is as follows \"Plot label\"  \"x axis label\" \n";
s+= " \"y axis label\"   \n are defines graphic label headings \n";
s+= "2 indicates number of data files data to be taken from in.txt and out.txt\n ";
s+= "in this case, the next number is the plot line type and the last 3 numbers are plot color\n";
s+= "(red green and blue 0 to 255).  \n ";
s+= "Plot line type codes are as follows :   \n ";
s+= "\"1 __ __ __ __ \",  \n ";
s+= "\"2 . _ . _ . _ \",  \n ";
s+= "\"3 . _ _ . . _ _ .\",  \n ";
s+= "\"4 - - - - - - - - \",  \n ";
s+= "\"5  ______\",  \n ";
s+= "\"6  __ __ __ __ \",  \n ";
s+= "\"7 . _ . _ . _ \",  \n ";
s+= "\"8  . _ _ . . _ _ .\",  \n ";
s+= "\"9 - - - - - \",  \n ";
s+="10  "+'\u2295'+"\n";
s+="11  "+'\u2297'+"\n";
s+="12  "+'\u2299'+"\n";
s+="13  "+'\u229A'+"\n";
s+="14  "+'\u229B'+"\n";
s+="15  "+'\u229E'+"\n";
s+="16  "+'\u22A0'+"\n";
s+="17  "+'\u22A1'+"\n";
s+="18  "+'\u22B9'+"\n";
s+="19  "+'\u22C7'+"\n";
s+= "\"20  square\",    \n ";
s+= "\"21  filled square\",  \n ";
s+= "\"22  circle\",  \n ";
s+= "\"23  filled circle\",  \n ";
s+= "\"24  triangle\",  \n ";
s+= "\"25  diamond \",  \n ";
s+= "\"26  pentagon\",  \n ";
s+= "\"27  hexagon\",  \n ";
s+= "\"28  filled triangle\",  \n ";
s+= "\"28  filled diamond\",  \n ";
s+= "\"30  filled pentagon\",  \n ";
s+= "\"31  filled hexagon\",  \n ";
s+= "\"32  3 sided star\",  \n ";
s+= "\"33  4 sided star\",  \n ";
s+= "\"34  5 sided star\",  \n ";
s+= "\"35  6 sided star\",  \n ";
s+= "\"36  filled 3 sided star\",  \n ";
s+= "\"37  filled 4 sided star\",  \n ";
s+= "\"38  filled 5 sided star\",  \n ";
s+= "\"39  filled 6 sided star\",  \n ";
s+= "\"40  bar graphic\",  \n ";
s+= "\"41  filled bar graphic\"};  \n ";
s+= ".   \n ";
s+= "  \n ";
s+= "Plot class is also draw a given function   \n ";
s+= "functions to be drawn should be extended to abstract class f_x.  \n ";
s+= "  \n ";
s+= "Program 1.6.13-8 (Dynamic version)  \n ";
s+= "import java.io.*;  \n ";
s+= "class f3 extends f_x  \n ";
s+= "{double func(double x)  \n ";
s+= " {return x*x*x+3.6*x*x-36.4;}}  \n ";
s+= "   \n ";
s+= "class PlotT06  \n ";
s+= "{public static void main (String args[]) throws IOException  \n ";
s+= " {f3 ff2=new f3();      \n ";
s+= "  Plot pp=new Plot(ff2,0.0,7.0,400,2);  \n ";
s+= "  pp.plot();}}  \n ";
s+= "  \n ";
s+= "Program 1.6.13-8A (Static version)  \n ";
s+= "import java.io.*;  \n ";
s+= "  \n ";
s+= "class f3 extends f_x  \n ";
s+= "{double func(double x)  \n ";
s+= " { return x*x*Math.abs(Math.sin(Math.sqrt(x)))-5.0;}}  \n ";
s+= "   \n ";
s+= "class PlotT06  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {Plot.func(new f3(),0.0,10.0,400,0);}  \n ";
s+= "  \n ";
s+= "The function given in the previous program is : f(x)=x3+3.6x2-36.4   \n ";
s+= "function is required to be plotted in between 0 and 7 with 400 data points\n ";
s+= "  \n ";
s+= "More than one function can be defined in the same plot window with one  \n ";
s+= "function class  \n ";
s+= "Program 1.6.13-9 (Dynamic version)  \n ";
s+= "import java.io.*;  \n ";
s+= "class f3 extends fi_x  \n ";
s+= "{  \n ";
s+= " double[] func(double x)  \n ";
s+= " { double f[]=new double[2];	   \n ";
s+= "   f[0]=x*Math.sin(10.0*Math.PI*x)+1.0;  \n ";
s+= "   f[1]=x*x;  \n ";
s+= "   return f;}}  \n ";
s+= "   \n ";
s+= "class PlotT03  \n ";
s+= "{public static void main (String args[]) throws IOException  \n ";
s+= "  { f3 ff2=new f3();      \n ";
s+= "    Plot pp=new Plot(ff2,-2.0,2.0,400,2);  \n ";
s+= "    pp.plot();}}  \n ";
s+= "  \n ";
s+= "Program 1.6.13-9A (Static versiyon)  \n ";
s+= "import java.io.*;  \n ";
s+= "  \n ";
s+= "class f3 extends fi_x  \n ";
s+= "{  \n ";
s+= " double[] func(double x)  \n ";
s+= " { double f[]=new double[2];	   \n ";
s+= "   f[0]=x*Math.sin(10.0*Math.PI*x)+1.0;  \n ";
s+= "   f[1]=x*x;  \n ";
s+= "   return f;}  \n ";
s+= "}  \n ";
s+= "  \n ";
s+= "class PlotT03  \n ";
s+= "{public static void main (String args[]) throws IOException  \n ";
s+= "  { Plot.func(new f3(),-2.0,2.0,400,2);}}  \n ";
s+= "  \n ";

s+= "or the same plot can be achieved by using different plot function classes.\n ";
s+= "  \n ";
s+= "Program 1.6.13-10  \n ";
s+= "import java.io.*;  \n ";
s+= "class f3 extends f_x  \n ";
s+= "{double func(double x)  \n ";
s+= " {return x*x;}}  \n ";
s+= "  \n ";
s+= "class f4 extends f_x  \n ";
s+= "{double func(double x)  \n ";
s+= " {return x*Math.sin(10.0*Math.PI*x)+1.0;}}  \n ";
s+= "   \n ";
s+= "class PlotT07  \n ";
s+= "{public static void main (String args[]) throws IOException  \n ";
s+= " {f3 ff3=new f3();  \n ";
s+= "  f4 ff4=new f4();      \n ";
s+= "  Plot pp=new Plot(ff3,-3.0,2.0,400);  \n ";
s+= "  pp.addFunction(ff4,-2.0,2.0,400);  \n ";
s+= "  pp.plot();}}  \n ";
s+= "  \n ";
s+= "Different plot zones can be defined when functions called seperately.   \n ";
s+= "For example in the previous program second function is called for -2,2  \n ";
s+= "zone  \n ";
s+= "  \n ";
s+= "pp.addFunction(ff4,-2.0,2.0,400);  \n ";
s+= "   \n ";
s+= "method addData is also available it adds additional data points \n ";
s+= "  \n ";
s+= "pp.addData(xx,yy,0,0,0,0);  \n ";
s+= "  \n ";
s+= "Last example combines different methods of the plot class together  \n ";
s+= "  \n ";
s+= "Program 1.6.13-11  \n ";
s+= "import java.io.*;  \n ";
s+= "   \n ";
s+= "class f3 extends fi_x  \n ";
s+= "{  \n ";
s+= " double[] func(double x)  \n ";
s+= " {  \n ";
s+= "   double f[]=new double[2];	   \n ";
s+= "   f[0]=Math.sin(x)+x/2;  \n ";
s+= "   f[1]=Math.sqrt(x);  \n ";
s+= "   return f;  \n ";
s+= " }}  \n ";
s+= "class PlotT3  \n ";
s+= "{  \n ";
s+= "     public static void main (String args[]) throws IOException  \n ";
s+= "     {//Plot pp=new Plot();  \n ";
s+= "     String fi[]={\"in.txt\",\"out.txt\"};  \n ";
s+= "     f3 ff=new f3();  \n ";
s+= "     int ipt[]={0,1};  \n ";
s+= "     int ir[]={0,0};  \n ";
s+= "     int ig[]={0,0};  \n ";
s+= "     int ib[]={0,2};  \n ";
s+= "     double xx[]={1,2,3,4,5,6};  \n ";
s+= "     double yy[]={2,3,4,5,6,7};  \n ";
s+= "     Plot pp=new Plot(fi); //read data from fi (in.txt,out.txt data are added up)  \n ";
s+= "     //pp.addData(fi);  \n ";
s+= "     pp.setPlotType(0,0);//  \n ";
s+= "     pp.setPlotType(1,1);//   \n ";
s+= "     pp.addData(xx,yy,0,0,0,0); //one set of addional data  \n ";
s+= "     pp.setPlotType(2,41);//bar chart  \n ";
s+= "     pp.setColor(2,0,0,255); //blue  \n ";
s+= "     pp.addFunction(ff,0.0,20.0,50,2,ipt,ir,ig,ib); //two additional function  \n ";
s+= "     pp.setPlabel(\"Fonksiyon Plot\");  \n ";
s+= "     pp.setXlabel(\"x ekseni\");  \n ";
s+= "     pp.setYlabel(\"y ekseni\");  \n ";
s+= "     pp.plot();}}  \n ";
s+= "  \n ";
s+= "Grafik Package basic components :   \n ";
s+= "  \n ";
s+= "Plot.java constructors, input and output methods  \n ";
s+= "PlotW.java  : basic graphic and control algorithms  \n ";
s+= "PlotShapesSW: defines different plot shapes such as line, star,triangle   \n ";
s+= "Plot2D : Converts shapes defined in the PlotShapesSW class into plot screen   \n ";
s+= "format   \n ";
s+= "\n";
s+= "The list of class Plot constructors  \n ";
s+= "  \n ";
s+= "======== Constructor classes : (defines the graphic window and prepare the data to be plotted)  \n ";
s+= "public Plot() throws IOException     \n ";
s+= "public Plot(String pl,String xl,String yl,int xnt,int ynt,int xgo,int ygo,String fn[],int ipt[],int ir[],int ig[]                  \n ";
s+= " ,int ib[]) throws IOException       \n ";
s+= "  public Plot(String fn[],int ipt[],int ir[],int ig[],int ib[]) throws IOException	  \n ";
s+= "  public Plot(String fn[]) throws IOException  : Read file names from String fn[] and plot them   \n ";
s+= "  public Plot(double xi[][],double yi[][],int ipt[],int ir[],int ig[],int ib[]) : read plot data from xi[][] and yi[][]  \n ";
s+= "  public Plot(double xiyi[][]) : read plot data xi[] and yi[] from xiyi[][] string     \n ";
s+= "  public Plot(double xi[][],double yi[][]) : read plot data from xi[][] and yi[][]  \n ";
s+= "  public Plot(double xi[],double yi[]) : read plot data from xi[] and yi[]  \n ";
s+= "  public Plot(f_x f,double xm,double xma,int N,int ipt,int ir,int ig,int ib)    \n ";
s+= " public Plot(f_x f,double xm,double xma,int N) : create plot data from a simple function f_x f  \n ";
s+= " public Plot(fi_x f,double xm,double xma,int Number_of_Data,int Number_of_Function)   \n ";
s+= "   \n ";
s+= "======== Static method definitions : (give short descriptions for one step plotting)  \n ";
s+= " public static double[] data(double xmin,double xmax,double dx)   \n ";
s+= " public static double[] data(double xmin,double xmax,int n)  \n ";
s+= " public static Plot func(f_x ff1,double xmin,double xmax,int n,int pnumber)  \n ";
s+= " public static Plot func(f_x ff1,double xmin,double xmax,int n)  \n ";
s+= " public static Plot func(f_x ff1,double xmin,double xmax)  \n ";
s+= " public static Plot func(fi_x ff1,double xmin,double xmax,int n,int pnumber)  \n ";
s+= " public static Plot func(fi_x ff1,double xmin,double xmax,int n)  \n ";
s+= " public static Plot func(fi_x ff1,double xmin,double xmax)  \n ";
s+= "  \n ";
s+= "======== Adding x,y and heading label ============ \n ";
s+= "  public void setPlabel(String ip) {label=ip;}  \n ";
s+= "  public void setXlabel(String ix) {xlabel=ix;}  \n ";
s+= "  public void setYlabel(String iy) {ylabel=iy;}  \n ";
s+= "  public void setXYlabel(String ix,String iy) {xlabel=ix;ylabel=iy;}  \n ";
s+= "  \n ";
s+= "======== Adding additional data into the graphic window =========== \n ";
s+= "public void addData(double xi[],double yi[])  \n ";
s+= "public void addData(double xi[],double yi[],int iplottype)  \n ";
s+= "public void addData(double xi[],double yi[],int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addData(double xi[][],double yi[][])  \n ";
s+= "public void addData(double xi[][],double yi[][],int ip[])  \n ";
s+= "public void addData(double xi[][],double yi[][],int ip[],int ir[],int ig[],int ib[])  \n ";
s+= "public void addFunction(f_x f,double xmi,double xma,int N,int ipt)  \n ";
s+= "public void addFunction(f_x f,double xmi,double xma,int N)  \n ";
s+= "public void addFunction(f_x f,double xmi,double xma,int N,int ipt,int ir,int ig,int ib)	  \n ";
s+= "public void addFunction(fi_x f,double xmin,double xmax,int Number_of_Data,int Number_of_Function)  \n ";
s+= "public void addFunction(fi_x f,double xmin,double xmax,int Number_of_Data,int Number_of_Function,int ipt[])  \n ";
s+= "public void addFunction(fi_x f,double xmin,double xmax,int Number_of_Data,int Number_of_Function, ,int ipt[])  \n ";
s+= "  \n ";
s+= "=======adding data with curve fit ============ \n ";
s+= "public void addOPEKK(double xi[],double yi[],int npolinom,int aradegersayisi)  \n ";
s+= "public void addOPEKK(double xi[],double yi[],int npolinom,int aradegersayisi,int iplottype)  \n ";
s+= "public void addOPEKK(double xi[],double yi[],int npolinom,int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addEKK(double xi[],double yi[],int npolinom,int aradegersayisi)  \n ";
s+= "public void addEKK(double xi[],double yi[],int npolinom,int aradegersayisi,int iplottype)  \n ";
s+= "public void addEKK(double xi[],double yi[],int npolinom,int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addEKK(int linenumber,int npolinom,int aradegersayisi,int iplottype)  \n ";
s+= "public void addEKK(int linenumber,int npolinom,int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addLagrange(double xi[],double yi[],int aradegersayisi)  \n ";
s+= "public void addLagrange(double xi[],double yi[],int aradegersayisi,int iplottype)  \n ";
s+= "public void addLagrange(double xi[],double yi[],int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addLagrange(int linenumber,int aradegersayisi,int iplottype)  \n ";
s+= "public void addLagrange(int linenumber,int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addB_Spline(double xi[],double yi[],int nSpline)  \n ";
s+= "public void addB_Spline(double ai[][],int nSpline)  \n ";
s+= "public void addB_Spline(double xi[],double yi[],int nSpline,int iplottype)  \n ";
s+= "public void addB_Spline(double xi[],double yi[],int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addB_Spline(int linenumber,int nSpline)  \n ";
s+= "public void addB_Spline(int linenumber,int nSpline,int iplottype)  \n ";
s+= "public void addB_Spline(int linenumber,int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addSpline(double xi[],double yi[],int nSpline)  \n ";
s+= "public void addSpline(double ai[][],int nSpline)  \n ";
s+= "public void addSpline(double xi[],double yi[],int nSpline,int iplottype)  \n ";
s+= "public void addSpline(double xi[],double yi[],int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "public void addSpline(int linenumber,int nSpline)  \n ";
s+= "public void addSpline(int linenumber,int nSpline,int iplottype)  \n ";
s+= "public void addSpline(int linenumber,int aradegersayisi,int iplottype,int ir,int ig,int ib)  \n ";
s+= "  \n ";
s+= "changing the graphic properties  \n ";
s+= "===========Graph type  =====================  \n ";
s+= "public void setPlotType(int plot_type[])	  \n ";
s+= "public void setPlotType(int dataset,int plot_no)  \n ";
s+= "public void setPlotType(int dataset,char plot_char)  \n ";
s+= "===========x and y grid  ===========================  \n ";
s+= "public void setXgrid(int igx)  \n ";
s+= "public void setYgrid(int igy)  \n ";
s+= "public void setGrid(int igx,int igy)  \n ";
s+= "public void setXtic(int ixt)  \n ";
s+= "public void setYtic(int iyt)  \n ";
s+= "public void setXYtic(int ixt,int iyt)  \n ";
s+= "==========logarithmic graphic scale openning and closing ==========  \n ";
s+= "public void setXlogScaleOn()  \n ";
s+= "public void setYlogScaleOn()  \n ";
s+= "public void setXlogScaleOff()  \n ";
s+= "public void setYlogScaleOff()  \n ";
s+= "==========setColor==========  \n ";
s+= "public void setColor(int dataset,int ired,int igreen,int iblue)  \n ";
s+= "public void setColor(int dataset,Color c)  \n ";
s+= "public void setColor(int ired[],int igreen[],int iblue[])  \n ";
s+= "public void setColor(Color c[])  \n ";
s+= "================ Setting maximum and minimum values of the plot window manually ====  \n ";
s+= "public void setMinMax()  \n ";
s+= "public void setMinMax(double xi[][],double yi[][])  \n ";
s+= "public void setMinMax(double iminx,double imaxx,double iminy,double imaxy)  \n ";
s+= "=============== Formatting graphic window ==================================  \n ";
s+= " public void set_plotwindow(int width,int height,double xip,double yip,double dxp,double dyp)   \n ";
s+= " public void setabsMaxMin(int ixmin,int iymin,int idx,int idy)  \n ";
s+= "  \n ";
s+= "Drawing the data in graphic format  \n ";
s+= "public void plot()  \n ";
s+= "==============================================================\n\n";
s+= " A final note : All the function library\n";
s+= " given in class Mathd. All the functions \n";
s+= " derived from our abstract class will include \n";
s+= " the functions in this library. Functions like \n";
s+= " Bessel function J(0,x), Legendre function P(2,x)\n";
s+= " etc. is already there. You can also add your own\n";
s+= " function into the mathd library and directly use \n";
s+= "this functions without futher definitions\n";
s+= "Program 1.6.13-8B (Static version)  \n ";
s+= "import java.io.*;  \n ";
s+= "  \n ";
s+= "class f3 extends f_x  \n ";
s+= "{double func(double x)  \n ";
s+= " { return J(0,x);}}  \n ";
s+= "   \n ";
s+= "class PlotT06  \n ";
s+= "{    public static void main (String args[]) throws IOException  \n ";
s+= "     {Plot.func(new f3(),0.0,10.0,400,0);}  \n ";
s+= "}  \n "; 
return s;}
      }

