import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.*;
import java.awt.GridLayout;

public class subjectivePane extends JPanel
{
    public JTextArea area1;
    public JTextArea area2;
    public JTextField campo1;
    public JTextField campo2;
    public JTextField campo3;
    public JLabel label1;
    public JLabel label2;
    public JLabel label3;
    public JLabel label4;
    public JLabel label5;
    public JLabel label6;

    public subjectivePane()
    {
//        super(new GridLayout(4, 1));

        SpringLayout layout = new SpringLayout();
        setLayout(layout);
        setOpaque(true);

        label3 = new JLabel("SIGNOS VITALES ACTUALES");
        campo1 = new JTextField(7);
        campo2 = new JTextField(7);
        campo3 = new JTextField(7);
        label4 = new JLabel("Presion Arterial");
        label5 = new JLabel("Pulso cardiaco");
        label6 = new JLabel("Temperatura corporal");

        add(label3);
        add(campo1);
        add(campo2);
        add(campo3);
        add(label4);
        add(label5);
        add(label6);

        layout.putConstraint(SpringLayout.NORTH, label3, 10, SpringLayout.NORTH, this);
        layout.putConstraint(SpringLayout.WEST, label3, 20, SpringLayout.WEST, this);
        layout.putConstraint(SpringLayout.NORTH, campo1, 10, SpringLayout.SOUTH, label3);
        layout.putConstraint(SpringLayout.WEST, campo1, 150, SpringLayout.WEST, this);
        layout.putConstraint(SpringLayout.NORTH, campo2, 10, SpringLayout.SOUTH, campo1);
        layout.putConstraint(SpringLayout.WEST, campo2, 150, SpringLayout.WEST, this);
        layout.putConstraint(SpringLayout.NORTH, campo3, 10, SpringLayout.SOUTH, campo2);
        layout.putConstraint(SpringLayout.WEST, campo3, 150, SpringLayout.WEST, this);

        layout.putConstraint(SpringLayout.NORTH, label4, 10, SpringLayout.SOUTH, label3);
        layout.putConstraint(SpringLayout.WEST, label4, 20, SpringLayout.WEST, this);
        layout.putConstraint(SpringLayout.NORTH, label5, 15, SpringLayout.SOUTH, label4);
        layout.putConstraint(SpringLayout.WEST, label5, 20, SpringLayout.WEST, this);
        layout.putConstraint(SpringLayout.NORTH, label6, 15, SpringLayout.SOUTH, label5);
        layout.putConstraint(SpringLayout.WEST, label6, 20, SpringLayout.WEST, this);

        label1 = new JLabel("DIAGNOSTICO");
        label2 = new JLabel("TRATAMIENTO");

        area1 = new JTextArea(5,25);
        JScrollPane scrollPane1 = new JScrollPane(area1);
        scrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        JComponent panel1 = makeScrollPanel(scrollPane1);

        area2 = new JTextArea(5,25);
        JScrollPane scrollPane2 = new JScrollPane(area2);
        scrollPane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        JComponent panel2 = makeScrollPanel(scrollPane2);

        //Creación del tabbedPane con sus tabs

        JTabbedPane tabbed = new JTabbedPane();
        tabbed.addTab("Diagnóstico", panel1);
        tabbed.addTab("Tratamiento", panel2);
        add(tabbed);
        tabbed.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

        layout.putConstraint(SpringLayout.NORTH, tabbed, 20, SpringLayout.SOUTH, campo3);
        layout.putConstraint(SpringLayout.WEST, tabbed, 15, SpringLayout.WEST, this);
    }

    protected JComponent makeScrollPanel(JScrollPane pane)
    {
            JPanel panel = new JPanel(false);
            panel.setLayout(new GridLayout(1, 1));
            panel.add(pane);
            return panel;
    }
}