//MaestroG.java

//import java.awt.*;
//import java.lang.*;

import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.net.*;
import java.awt.event.*;
import java.lang.*;


public class MaestroG{
    //MaestroG(){}
   
    //tipo=1 arrow up
    //
    public static final void drawArrow(int x, int y, int tipo, Graphics g){
	Graphics2D g2d = (Graphics2D)g; 
        switch (tipo){
	   case 1://ArrowUp
	  	g.drawLine(x,y,x,y-8);
		g.drawLine(x-3,y-2,x+3,y-2);
		g.drawLine(x-2,y-3,x+2,y-3);
		g.drawLine(x-2,y-4,x+2,y-4);
		g.drawLine(x-1,y-5,x+1,y-5);
		g.drawLine(x-1,y-6,x+1,y-6);
	   break;
	   case 2://Down
		g.drawLine(x,y,x,y+8);
		g.drawLine(x-1,y+6,x+1,y+6);
		g.drawLine(x-1,y+5,x+1,y+5);
		g.drawLine(x-2,y+4,x+2,y+4);
		g.drawLine(x-2,y+3,x+2,y+3);
		g.drawLine(x-3,y+2,x+3,y+2);
	   break;
	   case 3://ArrowRight
		g.drawLine(x,y,x+8,y);
		g.drawLine(x+6,y-1,x+6,y+1);
		g.drawLine(x+5,y-1,x+5,y+1);
		g.drawLine(x+4,y-2,x+4,y+2);
		g.drawLine(x+3,y-2,x+3,y+2);
		g.drawLine(x+2,y-3,x+2,y+3);
	   break;
	   case 4://ArrowLeft
		g.drawLine(x,y,x-8,y);
		g.drawLine(x-2,y-3,x-2,y+3);
		g.drawLine(x-3,y-2,x-3,y+2);
		g.drawLine(x-4,y-2,x-4,y+2);
		g.drawLine(x-5,y-1,x-5,y+1);
		g.drawLine(x-6,y-1,x-6,y+1); 
	  break;
          
          case 5://ArrowUpSmooth
               g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
                g.drawLine(x,y,x,y-8);
		//draw oblique arrow head
		Polygon pH = new Polygon();
		pH.addPoint(x-2, y-2);
		pH.addPoint(x+2, y-2);
		pH.addPoint(x,y-8);
		g.drawPolygon(pH);
		g.fillPolygon(pH);
                
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        
          break;
          
          case 6://ArrowDownSmooth
               g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
                g.drawLine(x,y,x,y+8);
		//draw oblique arrow head
		Polygon pJ = new Polygon();
		pJ.addPoint(x-2, y+2);
		pJ.addPoint(x+2, y+2);
		pJ.addPoint(x,y+8);
		g.drawPolygon(pJ);
		g.fillPolygon(pJ);
                
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
	   break;
           
           case 7://ArrowRightSmooth
               g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
                g.drawLine(x,y,x+8,y);
		//draw oblique arrow head
		Polygon pK = new Polygon();
		pK.addPoint(x+2, y-2);
		pK.addPoint(x+2, y+2);
		pK.addPoint(x+8,y);
		g.drawPolygon(pK);
		g.fillPolygon(pK);
                
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
	   
	   break;
           
           case 8://ArrowLeftSmooth
               g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
                g.drawLine(x,y,x-8,y);
		//draw oblique arrow head
		Polygon pL = new Polygon();
		pL.addPoint(x-2, y-2);
		pL.addPoint(x-2, y+2);
		pL.addPoint(x-8,y);
		g.drawPolygon(pL);
		g.fillPolygon(pL);
                
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
 
	   break;
           
           case 9://ArrowOblique 45 degrees NE
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
		//draw oblique arrow head
		Polygon pM = new Polygon();
                //draw oblique arrow head
                
                //pM.addPoint(x+6,y-6);
		//pM.addPoint(x-2,y-2);
		//pM.addPoint(x+2,y+2);
                
		pM.addPoint(x+5,y-5);
		pM.addPoint(x-1,y-2);
		pM.addPoint(x+2,y+1);
		
                g.drawPolygon(pM);
		g.fillPolygon(pM);
                
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
                 
           break;
           
           case 10://ArrowOblique 45 degrees SW
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
		//draw oblique arrow head
		Polygon pX = new Polygon();
                //draw oblique arrow head
                
                pX.addPoint(x-5,y+5);
		pX.addPoint(x+1,y+2);
		pX.addPoint(x-2,y-1);
		
                g.drawPolygon(pX);
		g.fillPolygon(pX);
                
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
                 
           break;
	}	
	
    }  
    
    public static final void drawArrowtip(int x, int y, int tipo, Graphics g){
	 switch (tipo){
	   case 1://ArrowUp
	  	g.drawLine(x,y-4,x,y-8);
		g.drawLine(x-3,y-2,x+3,y-2);
		g.drawLine(x-2,y-3,x+2,y-3);
		g.drawLine(x-2,y-4,x+2,y-4);
		g.drawLine(x-1,y-5,x+1,y-5);
		g.drawLine(x-1,y-6,x+1,y-6);
	   break;
	   case 2://Down
		g.drawLine(x,y+4,x,y+8);
		g.drawLine(x-1,y+6,x+1,y+6);
		g.drawLine(x-1,y+5,x+1,y+5);
		g.drawLine(x-2,y+4,x+2,y+4);
		g.drawLine(x-2,y+3,x+2,y+3);
		g.drawLine(x-3,y+2,x+3,y+2);
	   break;
	   case 3://ArrowRight
		g.drawLine(x+4,y,x+8,y);
		g.drawLine(x+6,y-1,x+6,y+1);
		g.drawLine(x+5,y-1,x+5,y+1);
		g.drawLine(x+4,y-2,x+4,y+2);
		g.drawLine(x+3,y-2,x+3,y+2);
		g.drawLine(x+2,y-3,x+2,y+3);
	   break;
	   case 4://ArrowLeft
		g.drawLine(x-4,y,x-8,y);
		g.drawLine(x-2,y-3,x-2,y+3);
		g.drawLine(x-3,y-2,x-3,y+2);
		g.drawLine(x-4,y-2,x-4,y+2);
		g.drawLine(x-5,y-1,x-5,y+1);
		g.drawLine(x-6,y-1,x-6,y+1); 
	  break;
	}	
	
    }  
    
    public static void addComponent(Container container, Component component, int gridx, int gridy,
	int gridwidth, int gridheight, int fill, int anchor) throws AWTException{
	    LayoutManager lm = container.getLayout();
	    if(!(lm instanceof GridBagLayout)){
		throw new AWTException ("Invalid layout"+lm);
	    }
	    else{
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.gridx = gridx;
		gbc.gridy = gridy;
		gbc.gridwidth = gridwidth;
		gbc.gridheight = gridheight;
		gbc.fill = fill;
		gbc.anchor = anchor;
		((GridBagLayout)lm).setConstraints(component, gbc);
		container.add(component);
	    }
    }
    
    public static void  SansNosansSymb(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("Serif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str2,x,y);
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("Symbol",Font.PLAIN,fsize+2));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }
    
    public static void  SerifSymbFirst(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize+2));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str2,x,y);
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize+2));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }

    public static void  SerifSymbFirstSub(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize+2));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
                
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-1));
		fm = g.getFontMetrics();
                y = y + fm.getHeight()/3;
                g.drawString(str2,x,y);
                y = y - fm.getHeight()/3;
                
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize+2));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }

    public static void  SanSerifSymbFirstSub(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
                
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-1));
		fm = g.getFontMetrics();
                y = y + fm.getHeight()/3;
                g.drawString(str2,x,y);
                y = y - fm.getHeight()/3;
                
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }
    
     public static void  SansNosansSymb2(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("Serif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str2,x,y);
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("Serif",Font.PLAIN,fsize+2));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }
     
    public static void  SansMiditalic(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.ITALIC,fsize+1));
		fm = g.getFontMetrics();
		g.drawString(str2,x,y);
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    public static void  SansMiditalicSuper(String str1, String str2, String str3, String str4, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
                
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y - fm.getHeight()/3;
		g.drawString(str2,x,y);
                x = x + fm.stringWidth(str2) + 1;
		y = y + fm.getHeight()/3;
		g.setFont(new Font("SanSerif",Font.ITALIC,fsize+1));
		fm = g.getFontMetrics();
		g.drawString(str3,x,y);
		x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str4,x,y);
    }
    
    public static void  subscripter(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    public static void  subscripterSerif(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("Serif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("Serif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    public static void  subsub(String str1, String str2, String str3, String str4, String str5, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
              
    }
    
    public static void  subscripter2(String str1, String str2, String str3, String str4, String str5, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);         
    }
    
    public static void  subscripterBs(String str1, String str2, String str2b, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
                
                g.setFont(new Font("Serif",Font.ITALIC,fsize+2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2b,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2b) + 1;
                
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }

    public static void  subscripterBs2(String str0, String str0b, String str1, String str2, String str2b, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
		fm = g.getFontMetrics();
		g.drawString(str0,x,y);
		x = x + fm.stringWidth(str0) + 1;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str0b,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str0b) + 1;
                
                g.setFont(new Font("SanSerif",Font.BOLD,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
                
                g.setFont(new Font("Serif",Font.ITALIC,fsize+2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2b,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2b) + 1;
                
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    
    public static void  subscripter3(String str1, String str2, String str3, String str4, String str5, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize+1));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-1));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);         
    }
    
    public static void  subsubsup(String str1, String str2, String str3, String str4, String str5, String str6, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                
                x = x + fm.stringWidth(str5) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y - fm.getHeight()/3;
		g.drawString(str6,x,y);
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		
    }
    
    public static void  subsubsubUn(String str1, String str1b, String str2, String str3, String str4, String str5, String str6, String str7, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-1));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1b,x,y);
		x = x + fm.stringWidth(str1b) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str4) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                
                x = x + fm.stringWidth(str5) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str6,x,y);
		
                x = x + fm.stringWidth(str6) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		y = y - fm.getHeight()/3;
		g.drawString(str7,x,y);
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		
    }
    
    public static void  subsubsubUn3(String str1, String str1b, String str2, String str3, String str4, String str5, String str6, String str7, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-1));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1b,x,y);
		x = x + fm.stringWidth(str1b) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str4) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                
                x = x + 3;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-1));
                fm = g.getFontMetrics();
		y = y - fm.getHeight()/3-1;
		g.drawString(str6,x,y);
		
                y = y + 2*fm.getHeight()/3+2;
                x = x + fm.stringWidth(str6) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		y = y - fm.getHeight()/3;
		g.drawString(str7,x,y);
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		
    }
    
    public static void  subscripterBsubsup(String str1, String str2, String str2B, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize-3));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3+1;
		g.drawString(str2,x,y);
                y = y - 2*fm.getHeight()/3-2;
                g.setFont(new Font("SanSerif",Font.BOLD,fsize-2));
		g.drawString(str2B,x,y);
		y = y + fm.getHeight()/3+2;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    public static void  subscripterBsubsup2(String str1, String str2, String str2B, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("Serif",Font.BOLD,fsize-4));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3+1;
		g.drawString(str2,x,y);
                y = y - 2*fm.getHeight()/3-2;
                g.setFont(new Font("SanSerif",Font.BOLD,fsize-2));
		g.drawString(str2B,x,y);
		y = y + fm.getHeight()/3+2;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }


    
    public static void  subsubsubsubsub(String str1, String str1b, String str2, String str2b, String str2c, String str3, String str4, String str5, String str6, String str7, String str8, String str9, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-1));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1b,x,y);
		x = x + fm.stringWidth(str1b) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str2b,x,y);
		x = x + fm.stringWidth(str2b) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2c,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2c) + 1;
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str4) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                x = x + fm.stringWidth(str5) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str6,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str6) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str7,x,y);
                x = x + fm.stringWidth(str7) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str8,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str8) + 1;
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str9,x,y);
		x = x + fm.stringWidth(str9) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		
    }
    
    public static void  subsubsubsubsub2(String str1, String str1b, String str2, String str2b, String str2c, String str3, String str4, String str5, String str6, String str7, String str8, String str9, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1b,x,y);
		x = x + fm.stringWidth(str1b) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str2b,x,y);
		x = x + fm.stringWidth(str2b) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2c,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2c) + 1;
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str4) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                x = x + fm.stringWidth(str5) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str6,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str6) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str7,x,y);
                x = x + fm.stringWidth(str7) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str8,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str8) + 1;
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str9,x,y);
		x = x + fm.stringWidth(str9) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		
    }
    
    public static void  subscripter2types(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    
    public static void  subsubsub(String str1, String str1b, String str2, String str3, String str4, String str5, String str6, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-1));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1b,x,y);
		x = x + fm.stringWidth(str1b) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str4) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                
                x = x + fm.stringWidth(str5) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str6,x,y);
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		
    }
    
    public static void  subsubsubsubsup(String str1, String str2, String str3, String str4, String str5, String str6, 
                                     String str7, String str8, String str9, String str10, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                
                x = x + fm.stringWidth(str5) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str6,x,y);
		
                y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str6) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str7,x,y);
                
                x = x + fm.stringWidth(str7) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str8,x,y);
		
                y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str8) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str9,x,y);
                
                x = x + fm.stringWidth(str9) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y - fm.getHeight()/3;
		g.drawString(str10,x,y);
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }
    
    public static void  subIsub(String str1, String str1b, String str2, String str3, String str4, String str5, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		
                g.setFont(new Font("Serif",Font.ITALIC,fsize+2));
		fm = g.getFontMetrics();
		g.drawString(str1b,x,y);
		x = x + fm.stringWidth(str1b) + 1;
		
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
                fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str4,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str4) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
              
    }
    
    public static void  subscripterInfinityOne(String str1, String str2, String str3, String str4, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
                
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		
                //create a symbol for "infinity".  JAVA 1.5 has a terrible rendition of the character
                //string str4 is not used
                g.setFont(new Font("Serif",Font.PLAIN,fsize+3));
                fm = g.getFontMetrics();
                g.setFont(new Font("Serif",Font.PLAIN,fsize+5));
                fm = g.getFontMetrics();
                g.drawString("o",x,y);
                g.drawString("o",x+5,y);
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }
    
    public static void  subscripterInfinityTwo(String str1, String str2, String str3, String str4, String str5, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		//create a symbol for "infinity".  JAVA 1.5 has a terrible rendition of the character
                //string str4 is not used
                g.setFont(new Font("Serif",Font.PLAIN,fsize+3));
                fm = g.getFontMetrics();
                g.setFont(new Font("Serif",Font.PLAIN,fsize+5));
                fm = g.getFontMetrics();
                g.drawString("o",x,y);
                g.drawString("o",x+5,y);
                
                x = x + fm.stringWidth("oo") + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
    }

    public static void  subscripterLargerLast(String str1, String str2, String str3, String str4, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize+4));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str4,x,y);
    }
    
    public static void  subscripterSymFirst(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize));
                g.setFont(new Font("Symbol",Font.PLAIN,fsize+1));
                fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }

    public static void  subscripterSymFirst2(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize+1));
                //g.setFont(new Font("Symbol",Font.PLAIN,fsize+1));
                fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }

    public static void  subscripterSymFirst2I(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.ITALIC,fsize+1));
                //g.setFont(new Font("Symbol",Font.PLAIN,fsize+1));
                fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    public static void  subscripterSS(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize+2));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    public static void  subscripterSS2(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize+1));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    public static void  subscripterSS3(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
    public static void  subscripterSSym(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("Serif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("Serif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("Symbol",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }

    
     public static void  subscripterSanSym(String str1, String str2, String str3, String str4, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
                g.setFont(new Font("Serif",Font.PLAIN,fsize));
		g.setFont(new Font("Symbol",Font.PLAIN,fsize+1));
                fm = g.getFontMetrics();
		g.drawString(str4,x,y);
    }
    
    public static void  subscripterSanSym2(String str1, String str2, String str3, String str4, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
                g.setFont(new Font("Serif",Font.PLAIN,fsize+2));
		//g.setFont(new Font("Symbol",Font.PLAIN,fsize+1));
                fm = g.getFontMetrics();
		g.drawString(str4,x,y);
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }

    public static void  subscripterSanSym3(String str1, String str2, String str3, String str4, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
                g.setFont(new Font("Serif",Font.PLAIN,fsize+1));
		//g.setFont(new Font("Symbol",Font.PLAIN,fsize+1));
                fm = g.getFontMetrics();
		g.drawString(str4,x,y);
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
    }
    
    public static void  subscripterSymMiddle(String str1, String str2, String str3, String str4, String str5, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
                g.setFont(new Font("Serif",Font.PLAIN,fsize));
		g.setFont(new Font("Symbol",Font.PLAIN,fsize+1));
                fm = g.getFontMetrics();
		g.drawString(str4,x,y);
                x = x + fm.stringWidth(str4) + 1;
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                
    }
    
    public static void  subscripterSymMiddle2(String str1, String str2, String str3, String str4, String str5, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
                x = x + fm.stringWidth(str3) + 1;
                g.setFont(new Font("Serif",Font.PLAIN,fsize+1));
		//g.setFont(new Font("Symbol",Font.PLAIN,fsize+1));
                fm = g.getFontMetrics();
		g.drawString(str4,x,y);
                x = x + fm.stringWidth(str4) + 1;
                g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str5,x,y);
                
    }
     
    public static void  subscripterB(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize-2));
		fm = g.getFontMetrics();
		y = y + fm.getHeight()/4;
		g.drawString(str2,x,y);
		y = y - fm.getHeight()/4;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.BOLD,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    }
    
     
    public static void  superscripter(String str1, String str2, String str3, Graphics g, int fsize, int x, int y){
		FontMetrics fm;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
		fm = g.getFontMetrics();
		g.drawString(str1,x,y);
		x = x + fm.stringWidth(str1) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize-2));
		fm = g.getFontMetrics();
		y = y - fm.getHeight()/3;
		g.drawString(str2,x,y);
		y = y + fm.getHeight()/3;
		x = x + fm.stringWidth(str2) + 1;
		g.setFont(new Font("SanSerif",Font.PLAIN,fsize));
                fm = g.getFontMetrics();
		g.drawString(str3,x,y);
    } 
    
    public static void drawCircle(int x, int y, int radius, Graphics g){
                Graphics2D g2d = (Graphics2D)g;
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
		g.drawOval(x-radius/2,y-radius/2,radius,radius);
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
            
    }
    
    public static void fillCircle(int x, int y, int radius, Graphics g){
                Graphics2D g2d = (Graphics2D)g;
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
                g.fillOval(x-radius/2,y-radius/2,radius,radius);
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
            
    }    

    
    public static void drawArcThick(Graphics g, double xCenter, double yCenter, double Radius, double startangle, double endangle, int thick, Color color){
	
            Graphics2D g2d = (Graphics2D)g;
            g2d.setPaint(color);
            g2d.setStroke(new BasicStroke(thick));
        
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
            Arc2D.Double arc_one = new Arc2D.Double(xCenter,yCenter,Radius,Radius,startangle,endangle,0);
            g2d.draw(arc_one);
  
            g2d.setStroke(new BasicStroke(1));
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
    }
    
    public static void FillArcTransp(Graphics g, double xCenter, double yCenter, double Radius, double startangle, double endangle, Color color, double alphachan){
	boolean smoothing = true;
        int rule; float alpha;
        rule = AlphaComposite.SRC_OVER;
        alpha = (float)alphachan;
        
        Graphics2D g2d = (Graphics2D)g;
        g2d.setPaint(color);
        //g2d.setStroke(new BasicStroke(thick));
        g2d.setComposite(AlphaComposite.getInstance(rule, alpha));
        
        if(smoothing){
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        }
        else{
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        }
        Arc2D.Double arc_one = new Arc2D.Double(xCenter,yCenter,Radius,Radius,startangle,endangle,2);
        g2d.fill(arc_one);
  
        //g2d.setStroke(new BasicStroke(1));
        //g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
        g2d.setComposite(AlphaComposite.getInstance(rule, 1.0f));
}
    
    public static void drawCircleThick(Graphics g, double xCenter, double yCenter, double Radius, int thick, Color color){
	
        Graphics2D g2d = (Graphics2D)g;
        g2d.setPaint(color);
        g2d.setStroke(new BasicStroke(thick, BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL));
        
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
        Ellipse2D.Double circle = new Ellipse2D.Double(xCenter-Radius,yCenter-Radius,2*Radius,2*Radius);
        g2d.draw(circle);
        g2d.setStroke(new BasicStroke(1));
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
    }
    
    public static void fillCircleThick(Graphics g, double xCenter, double yCenter, double Radius, int thick, Color color){
	
        Graphics2D g2d = (Graphics2D)g;
        g2d.setPaint(color);
        g2d.setStroke(new BasicStroke(thick, BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL));
        
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
        Ellipse2D.Double circle = new Ellipse2D.Double(xCenter-Radius,yCenter-Radius,2*Radius,2*Radius);
        g2d.fill(circle);
        g2d.setStroke(new BasicStroke(1));
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
    }

    public static void drawStencil(Graphics g, int width, int height, int radius, int xcenter, int ycenter, Color stencilcolor){
	int rule; float alpha;
        rule = AlphaComposite.SRC_OVER;
        alpha = 1.0f;
        
        Graphics2D g2d = (Graphics2D)g;
        g2d.setPaint(stencilcolor);      
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setComposite(AlphaComposite.getInstance(rule, alpha));
        
        Area a1, a2, a3;
        
	Rectangle2D newrect = new Rectangle2D.Double(0.0,0.0,(double)width,(double)height);
        a1 = new Area(newrect);
        Ellipse2D newellipse = new Ellipse2D.Double((double)(xcenter-radius),(double)(ycenter-radius),(double)(radius*2),(double)(radius*2));
        a2 = new Area(newellipse);
        a3 = new Area();
        a3.add(a1);
        a3.subtract(a2);
        g2d.fill(a3);
        
        //g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
    }

    public static void drawLineThick(Graphics g, double x1, double y1, double x2, double y2, int thick, Color color){
	
        Graphics2D g2d = (Graphics2D)g;
        g2d.setPaint(color);
        g2d.setStroke(new BasicStroke(thick,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
        
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
        Line2D.Double line = new Line2D.Double(x1,y1,x2,y2);
        g2d.draw(line);
  
        g2d.setStroke(new BasicStroke(1));
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
    }
    
    public static void drawLineThickB(Graphics g, double x1, double y1, double x2, double y2, int thick, int pat1, int pat2, Color color){
	
        Graphics2D g2d = (Graphics2D)g;
        g2d.setPaint(color);
        float[] dashPattern = {pat1,pat2};
        g2d.setStroke(new BasicStroke(thick,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,10.0F,dashPattern,0));
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        
        Line2D.Double line = new Line2D.Double(x1,y1,x2,y2);
        g2d.draw(line);
 
        g2d.setStroke(new BasicStroke(1.0F,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
    }



}

