/*
 * Formular.java
 *
 * Created on Nedeľa, 2008, marec 2, 17:52
 */
package data;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *
 * @author  chislim
 */
public class Formular extends javax.swing.JFrame
{

    private final static String newline = "\n";
    public static String ss;
    public static PrintWriter out;
  public static String outF;
    /** Creates new form Formular */
    public void vynulujSs() 
    {
        ss = "";
    }

    public String getSs()
    {
        return ss;
    }

   
    protected void finalize() throws Throwable
{   
      
      super.finalize();
      out.close();
}
    
    public Formular(String outF) throws IOException
    { 
        File file = new File(outF);
        Formular.outF=outF;
        out = new PrintWriter(new FileWriter(file));
        initComponents();
       
    }

    /** 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.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 864, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 705, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    /**
     * @param args the command line arguments
     */
    public void vypis(String s)
    {

        ss += s;
        jTextArea1.append(s + newline);
      
    }
       public void _vypis(String s)
    {

        ss += s;
        jTextArea1.append(s + newline);

        out.println(Utils.stringToTex(s));
       
        //out.println(line);
    }

    public void vypis3(String s)
    {

        jTextArea1.append(s + newline);

    }

    public void vypis2(String s)
    {

        ss += s;
        jTextArea1.append(s);
    }
    
    public void _vypis2(String s)
    {
        ss += s;
        jTextArea1.append(s);
        out.print(Utils.stringToTex(s));
    }

    public void vypis4(String s)
    {
        jTextArea1.append(s);
    }
    
    public void _vypis4(String s)
    {
        jTextArea1.append(s);
        out.print(Utils.stringToTex(s));
    }

    public static void main(String args[]) 
    {
        java.awt.EventQueue.invokeLater(new Runnable() 
        {
 
            public void run() 
            {
                try
                {
                    new Formular(outF).setVisible(true);
                }
                catch (IOException e) 
                {
                    e.printStackTrace();
                }
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables
}
