import java.awt.*;
import javax.swing.*;


public class apskaita extends JFrame
{
   private Container screen;
   private GridBagLayout layout;
   private GridBagConstraints constraints; 
   private JLabel labels[] = new JLabel[255]; 
   private JSeparator separators[] = new JSeparator[30];
   private JTextField textfields[] = new JTextField[255];
	
	public apskaita()
	{
	  super ("Apskaita");
      screen = getContentPane();
      layout = new GridBagLayout();
      screen.setLayout( layout );   
		
	  constraints = new GridBagConstraints();
	  
	  labels[0] = new JLabel (" Abon. m. ");
	  labels[1] = new JLabel (" Nuo ");
	  labels[2] = new JLabel (" Iki ");
	  labels[3] = new JLabel (" Skirtumas ");
	  labels[4] = new JLabel (" Kaina ");
	  labels[5] = new JLabel (" Suma ");

	  labels[5].setForeground(Color.red);
	  
	  labels[6] = new JLabel (" Elektra diena ");
	  labels[7] = new JLabel (" Elektra nakti ");
	  labels[8] = new JLabel (" Dujos ");
	  labels[9] = new JLabel (" Saltas vanduo");
	  
	  for (int r= 0; r<= 20; r++)
	  {
	  	separators[r] = new JSeparator();
	  } 
	  for (int r = 0; r<= 20; r++)
	  {
	     textfields[r] = new JTextField("", 10); 
	  }
	  
	  int i = 0;
      for (int r = 1; r<= 6; r++)
      {  
        addComponent(labels[i], 0,r,1,1);
        i++;
      }
      
      i = 6;
      for (int r = 1; r<= 3; r++)
      {  
        addComponent(labels[i], r,0,1,1);
        i++;
      }
      
      i = 0;
      for (int r = 1; r<= 3; r++)
      {
      	for (int p = 2; p<= 6; p++)
      	{
      		addComponent (textfields[i], r,p,1,1);
      		i++;  	
      	}
      }
     
      addComponent(textfields[i], 3,1,1,1);
      for (int r = 0; r<= 6; r++)
      {
      	addComponent (separators[r], 5,1,1,1);
      }
      
      addComponent (labels[9], 6,0,1,1);
      
      for (int r = 2; r<= 6; r++)
      {
         i++;
         addComponent (textfields[i], 6,r,1,1); 
      }
      
      
      
      pack();
      setVisible( true );	
		
	}	
	
	
   private void addComponent( Component component, int row, int column, int width, int height )
   {
      
      constraints.gridx = column;
      constraints.gridy = row;

      
      constraints.gridwidth = width;   
      constraints.gridheight = height;

      layout.setConstraints(component, constraints);  
      screen.add(component);      
   }

	
   public static void main( String args[] )
   {
      apskaita application = new apskaita();

      application.setDefaultCloseOperation(
         JFrame.EXIT_ON_CLOSE );
   }
	
	
}