import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Component;

/**
 * JPaintLayoutManager is an extension of GridBagLayout, this class is a helper
 * class for the GridBagLayout. It makes using this layout easier.
 **/
public class JPaintLayoutManager extends GridBagLayout
{
	private GridBagConstraints gbc;
	private Component comp;
	
	/** Creates a default JPaintLayoutManager. **/
	public JPaintLayoutManager()
	{
		gbc = new GridBagConstraints();
	}
	
	/** Sets the components necessary to get the layout started. **/
	public void setComponent(Component compo, int gridx, int gridy, int gridwidth, int gridHeight,
								int ipadx, int ipady, int weightx, int weighty, int fill)
	{
			comp = compo;
			gbc.gridx = gridx;
			gbc.gridy = gridy;
			gbc.gridwidth = gridwidth;
			gbc.gridheight = gridHeight;
			gbc.ipadx = ipadx;
			gbc.ipady = ipady;
			gbc.weightx = weightx;
			gbc.weighty = weighty;
			gbc.fill = fill;
			setConstraints(compo, gbc); 						
	}
	
	/** Sets the gridX. **/
	public void setgridx(int gridx)
	{
		gbc.gridx = gridx;
		setConstraints(comp, gbc);
	}
	
	/** Sets the gridY. **/
	public void setGridY(int gridy)
	{
		gbc.gridy = gridy;
		setConstraints(comp, gbc);
	}
	
	/** Sets the gridWidth. **/
	public void setGridWidth(int gridwidth)
	{
		gbc.gridwidth = gridwidth;
		setConstraints(comp, gbc);
	}
	
	/** Sets the gridHeight. **/
	public void setGridHeight(int gridheight)
	{
		gbc.gridheight = gridheight;
		setConstraints(comp, gbc);
	}
	
	/** Sets the ipadX. **/
	public void setIpadx(int ipadx)
	{
		gbc.ipadx = ipadx;
		setConstraints(comp, gbc);
	}

	/** Sets the ipadY. **/
	public void setIpady(int ipady)
	{
		gbc.ipady = ipady;
		setConstraints(comp, gbc);
	}
	
	/** Sets the xWeight. **/
	public void setWeightx(int weightx)
	{
		gbc.weightx = weightx;
		setConstraints(comp, gbc);
	}
	
	/** Sets the yWeight. **/
	public void setWeighty(int weighty)
	{
		gbc.weighty = weighty;
		setConstraints(comp, gbc);
	}
	
	/** Sets the anchor. **/
	public void setAnchor(int anchor)
	{
		gbc.anchor = anchor;
		setConstraints(comp, gbc);		
	}
	
	/** Resets all the variables to its default settings. **/
	public void reset()
	{
		gbc.gridx = 0;
		gbc.gridy = 0;
		gbc.gridwidth = 0;
		gbc.gridheight = 0;
		gbc.ipadx = 0;
		gbc.ipady = 0;
		gbc.weightx = 0;
		gbc.weighty= 0;
	}
}