//MaestroG.java

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

public class MaestroG{
    MaestroG(){};
    //tipo=1 arrow up
    //
    public static final void drawArrow(int x, int y, int tipo, Graphics 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;
	}	
	
    }  
    
    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  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));
		g.drawString(str3,x,y);
    }
    
    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  subscripter2(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.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.PLAIN,fsize));
		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));
		g.drawString(str3,x,y);
    } 
    
    public static void drawCircle(int x, int y, int radius, Graphics g){
		g.drawOval(x-radius/2,y-radius/2,radius,radius);
    }
    
    public static void fillCircle(int x, int y, int radius, Graphics g){
		g.fillOval(x-radius/2,y-radius/2,radius,radius);
    }    
}