/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package estaticas;

import java.awt.GridBagConstraints;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Vector;

/**
 *
 * @author Jose
 */
public class estaticas {

    public static GridBagConstraints createConstraints(int gridx, int gridy, int width, int height, double weightx,
            double weighty, int anchor, int fill) {

        GridBagConstraints constraints = new GridBagConstraints();

        constraints.gridx = gridx;
        constraints.gridy = gridy;
        constraints.gridwidth = width;
        constraints.gridheight = height;
        constraints.weightx = weightx;
        constraints.weighty = weighty;
        constraints.fill = fill;
        constraints.anchor = anchor;

        return constraints;
    }

    public static GridBagConstraints createConstraints(int gridx, int gridy, int width, int height, double weightx,
            double weighty) {
        GridBagConstraints constraints = new GridBagConstraints();

        constraints.gridx = gridx;
        constraints.gridy = gridy;
        constraints.gridwidth = width;
        constraints.gridheight = height;
        constraints.weightx = weightx;
        constraints.weighty = weighty;

        return constraints;
    }

    public static String[] vectorToStringArray(Vector input) {
        String[] output = new String[input.size()];
        for (int i = 0; i < output.length; i++) {
            output[i] = input.get(i).toString();
        }
        return output;
    }

    public static void saveTextFile(String contents, File file) throws IOException {
        PrintWriter out = new PrintWriter(new FileWriter(file));
        out.print(contents);
        out.close();
    }
}
