// herbruikbare package

package be.styleit;

import java.awt.*;
import javax.swing.*;

public class H17_paginaUI extends JPanel {
	
	protected final static String names[] = { "Titel:","Keywoorden:","Beschrijving:","CSS-Bestand:","Body kleur:","Hoogte:","Breedte:"};
	protected final static String titels[] = { "Gegevens:"," ", ""," ","Code:"," " };
	
	protected JLabel labels[];
	protected JLabel titelLabels[];
	protected JTextField fields[];
	protected JSeparator lijn[];
	protected JButton doTask1, doTask2;
	protected JPanel innerPanelCenter, innerPanelSouth;
	protected JTextArea resultaat;
	protected Font verdana = new Font("Verdana",10,10);
	protected Font verdana_bold = new Font("Verdana Bold",10,10);
	

	public H17_paginaUI() {
		
		labels = new JLabel[7];
		fields = new JTextField[7];
		titelLabels = new JLabel[6];
		lijn = new JSeparator[4];
		
		for (int count = 0; count < labels.length; count++) {
			labels[count] = new JLabel(names[count]);
			labels[count].setFont(verdana);
		}
		
		for (int count = 0; count < fields.length; count++) {
			fields[count] = new JTextField(600);
			fields[count].setFont(verdana);
		}
		
		for (int count = 0; count < titelLabels.length; count++) {
			titelLabels[count] = new JLabel(titels[count]);
			titelLabels[count].setFont(verdana_bold);
		}

		
		for (int count = 0; count < lijn.length; count++) {
			lijn[count] = new JSeparator(0);
		}
		
		innerPanelCenter = new JPanel();
		innerPanelCenter.setLayout(new GridLayout (12,2));
		
		
		innerPanelCenter.add(titelLabels[0]);
		innerPanelCenter.add(titelLabels[1]);
		innerPanelCenter.add(lijn[0]);
		innerPanelCenter.add(lijn[1]);
		
		for (int count = 0; count < 7; count++) {
			innerPanelCenter.add(labels[count]);
			innerPanelCenter.add(fields[count]);
		}
		
		innerPanelCenter.add(titelLabels[2]);
		innerPanelCenter.add(titelLabels[3]);
		innerPanelCenter.add(titelLabels[4]);
		innerPanelCenter.add(titelLabels[5]);
		innerPanelCenter.add(lijn[2]);
		innerPanelCenter.add(lijn[3]);
		
		resultaat = new JTextArea();
		resultaat.setFont(verdana);
		JScrollPane scroller = new JScrollPane(resultaat);
		
		doTask1 = new JButton();
		doTask2 = new JButton();
		
		innerPanelSouth = new JPanel();
		innerPanelSouth.add (doTask1);
		innerPanelSouth.add (doTask2);
		
		setLayout(new BorderLayout());
		add (innerPanelCenter,BorderLayout.NORTH);
		add (scroller,BorderLayout.CENTER);
		add (innerPanelSouth,BorderLayout.SOUTH);
		
		validate();
		
	}
		
	public JButton getDoTask1Button() {
		return doTask1;
	}
		
	public JButton getDoTask2Button() {
		return doTask2;
	}
	
	public JTextArea getResultaat() {
		return resultaat;
	}
	
	public JTextField[] getFields() {
		return fields;
	}
	
	public void setFieldValues() {
	
		for (int count = 0; count < 7; count++)
			fields[count].setText("");
	}
	
	public String[] getFieldValues() {
		String values[] = new String[7];
		
		for ( int count = 0; count < 7; count++)
			values[count] = fields[count].getText();
		
		return values;
	}
	
}
