/*
 * Wind2ConfigAnemometer.java
 *
 * Created on October 19, 2006, 2:05 AM
 */

import java.awt.*;

public class Wind2ConfigAnemometer extends javax.swing.JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	//private String section;
	private IniFile inifile;
    
    /** Creates new form Wind2ConfigAnemometer */
    public Wind2ConfigAnemometer(int i, IniFile ini) {
    	inifile = ini;
        initComponents(i);
    }

    public void saveIni (IniFile ini, int i) {
	ini.setValue("AN" + i, "type", textType.getText());
	ini.setValue("AN" + i, "height", textHeight.getText());
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents(int i) {//GEN-BEGIN:initComponents
        labelType = new javax.swing.JLabel();
        textType = new javax.swing.JTextField(10);
        labelHeight = new javax.swing.JLabel();
        textHeight = new javax.swing.JTextField(4);

	GridBagLayout grid = new GridBagLayout();
	GridBagConstraints cons = new GridBagConstraints();
	setLayout(grid);
//        setLayout(new java.awt.GridLayout(2, 2, 5, 3));
	cons.insets = new Insets(0, 4, 0, 4);

        setBorder(new javax.swing.border.TitledBorder("Anemometer " + i + ":"));
	cons.gridx = 0;
	cons.gridy = 0;
	cons.anchor = GridBagConstraints.LINE_START;
	grid.setConstraints(labelType, cons);
        labelType.setText("Type: ");
        add(labelType);

	cons.gridx = 2;
	cons.gridy = 0;
	cons.anchor = GridBagConstraints.LINE_END;
	grid.setConstraints(textType, cons);
        textType.setText(inifile.getValue("AN" + i, "type"));
        add(textType);

	cons.gridx = 0;
	cons.gridy = 1;
	cons.anchor = GridBagConstraints.LINE_START;
	grid.setConstraints(labelHeight, cons);
        labelHeight.setText("Height:");
        add(labelHeight);

	cons.gridx = 2;
	cons.gridy = 1;
	cons.anchor = GridBagConstraints.LINE_END;
	grid.setConstraints(textHeight, cons);
        textHeight.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        textHeight.setText(inifile.getValue("AN" + i, "height"));
        add(textHeight);

    }//GEN-END:initComponents
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel labelHeight;
    private javax.swing.JLabel labelType;
    private javax.swing.JTextField textHeight;
    private javax.swing.JTextField textType;
    // End of variables declaration//GEN-END:variables
    
}
