/*
 * menu1.java
 *
 * Created on 2 de enero de 2007, 23:49
 */
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.ImageIcon;

/**
 *
 * @author  David
 */
public class menu1 extends javax.swing.JFrame {

    Image imagenResultado, imagenFuente;
    
    /** Creates new form menu1 */
    public menu1() {
        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() {
        jPanel1 = new javax.swing.JPanel();
        jPanelRadio = new javax.swing.JPanel();
        imagenRadio = new javax.swing.JLabel();
        jRadio2 = new javax.swing.JTextField();
        jRadio1 = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        imagenRadio1 = new javax.swing.JLabel();
        jPanelError = new javax.swing.JPanel();
        jError1 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jError2 = new javax.swing.JTextField();
        jPanelPolinomio = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jPolinomio1 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jPolinomio2 = new javax.swing.JTextField();
        ImagenTrayectoria = new javax.swing.JLabel();
        jPanelConfiguracion = new javax.swing.JPanel();
        jPanelFicheroEntrada = new javax.swing.JPanel();
        jRutaImagenes = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jNImagenes = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jNImagenesASaltar = new javax.swing.JTextField();
        jInverso = new javax.swing.JCheckBox();
        jPanelCondicionesParada = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jMaxIter = new javax.swing.JTextField();
        jMaxError = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jPrecisionInicial = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jMaxPrecision = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jPanelCondicionesParada1 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        ja = new javax.swing.JTextField();
        jb = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jc = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jd = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jMenu = new javax.swing.JMenuBar();
        jMenuArchivo = new javax.swing.JMenu();
        jMenuItemAbrir = new javax.swing.JMenuItem();
        jMenuCalcular = new javax.swing.JMenu();
        jMenuItemCalcularRadio = new javax.swing.JMenuItem();
        jMenuItemCalcularTrayectoria = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("C\u00e1lculo de trayectorias y radios de sat\u00e9lites");
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Salida"));
        jPanelRadio.setBorder(javax.swing.BorderFactory.createTitledBorder("Radio del sat\u00e9lite"));
        imagenRadio.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        imagenRadio.setText("Imagen Real");
        imagenRadio.setBorder(javax.swing.BorderFactory.createTitledBorder("Imagen Real"));

        jRadio2.setEditable(false);
        jRadio2.setText("0");

        jRadio1.setEditable(false);
        jRadio1.setText("0");

        jLabel15.setText("Radio 2");

        jLabel16.setText("Radio 1");

        imagenRadio1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        imagenRadio1.setText("Imagen Virtual");
        imagenRadio1.setBorder(javax.swing.BorderFactory.createTitledBorder("Imagen Virtual"));

        org.jdesktop.layout.GroupLayout jPanelRadioLayout = new org.jdesktop.layout.GroupLayout(jPanelRadio);
        jPanelRadio.setLayout(jPanelRadioLayout);
        jPanelRadioLayout.setHorizontalGroup(
            jPanelRadioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelRadioLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelRadioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanelRadioLayout.createSequentialGroup()
                        .add(jPanelRadioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jLabel15)
                            .add(jLabel16))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanelRadioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jRadio2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jRadio1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)))
                    .add(jPanelRadioLayout.createSequentialGroup()
                        .add(imagenRadio, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 121, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(imagenRadio1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 121, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        jPanelRadioLayout.setVerticalGroup(
            jPanelRadioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelRadioLayout.createSequentialGroup()
                .add(jPanelRadioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(imagenRadio, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(imagenRadio1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jPanelRadioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel16)
                    .add(jRadio1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelRadioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel15)
                    .add(jRadio2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanelError.setBorder(javax.swing.BorderFactory.createTitledBorder("Error en la trayectoria"));
        jError1.setEditable(false);
        jError1.setText("0");

        jLabel12.setText("Error M\u00ednimos cuadrados");

        jLabel13.setText("Error por Stepest-Ascent");

        jError2.setEditable(false);
        jError2.setText("0");

        org.jdesktop.layout.GroupLayout jPanelErrorLayout = new org.jdesktop.layout.GroupLayout(jPanelError);
        jPanelError.setLayout(jPanelErrorLayout);
        jPanelErrorLayout.setHorizontalGroup(
            jPanelErrorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelErrorLayout.createSequentialGroup()
                .add(jPanelErrorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel12)
                    .add(jLabel13))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelErrorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jError2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jError1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)))
        );
        jPanelErrorLayout.setVerticalGroup(
            jPanelErrorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelErrorLayout.createSequentialGroup()
                .add(jPanelErrorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel12)
                    .add(jError1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelErrorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel13)
                    .add(jError2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanelPolinomio.setBorder(javax.swing.BorderFactory.createTitledBorder("Polinomio de la trayectoria"));
        jLabel10.setText("Polinomio M\u00edn Cuadrados");

        jPolinomio1.setEditable(false);
        jPolinomio1.setText("0x3 + 0x2 + 0x + 0");

        jLabel11.setText("Polinomio Stepest-Ascent");

        jPolinomio2.setEditable(false);
        jPolinomio2.setText("0x3 + 0x2 + 0x + 0");

        org.jdesktop.layout.GroupLayout jPanelPolinomioLayout = new org.jdesktop.layout.GroupLayout(jPanelPolinomio);
        jPanelPolinomio.setLayout(jPanelPolinomioLayout);
        jPanelPolinomioLayout.setHorizontalGroup(
            jPanelPolinomioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelPolinomioLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelPolinomioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel10)
                    .add(jLabel11))
                .add(14, 14, 14)
                .add(jPanelPolinomioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jPolinomio2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 614, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPolinomio1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 614, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanelPolinomioLayout.setVerticalGroup(
            jPanelPolinomioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelPolinomioLayout.createSequentialGroup()
                .add(jPanelPolinomioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel10)
                    .add(jPolinomio1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelPolinomioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel11)
                    .add(jPolinomio2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
        );

        ImagenTrayectoria.setBorder(javax.swing.BorderFactory.createTitledBorder("Trayectoria del sat\u00e9lite"));
        ImagenTrayectoria.setMaximumSize(null);

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanelPolinomio, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                        .add(ImagenTrayectoria, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 445, Short.MAX_VALUE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanelRadio, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(jPanelError, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanelRadio, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanelError, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(ImagenTrayectoria, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelPolinomio, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );

        jPanelConfiguracion.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuraci\u00f3n"));
        jPanelFicheroEntrada.setBorder(javax.swing.BorderFactory.createTitledBorder("Ficheros de entrada"));
        jRutaImagenes.setText("c:\\Ex1\\ima");

        jLabel8.setLabelFor(jRutaImagenes);
        jLabel8.setText("Ruta Im\u00e1genes");

        jNImagenes.setText("236");

        jLabel3.setLabelFor(jNImagenes);
        jLabel3.setText("N\u00ba Im\u00e1genes");

        jLabel4.setLabelFor(jNImagenesASaltar);
        jLabel4.setText("N\u00ba Im\u00e1genes a saltar");

        jNImagenesASaltar.setText("4");

        jInverso.setText("Inverso");
        jInverso.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jInverso.setMargin(new java.awt.Insets(0, 0, 0, 0));

        org.jdesktop.layout.GroupLayout jPanelFicheroEntradaLayout = new org.jdesktop.layout.GroupLayout(jPanelFicheroEntrada);
        jPanelFicheroEntrada.setLayout(jPanelFicheroEntradaLayout);
        jPanelFicheroEntradaLayout.setHorizontalGroup(
            jPanelFicheroEntradaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelFicheroEntradaLayout.createSequentialGroup()
                .add(jPanelFicheroEntradaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel4)
                    .add(jLabel8)
                    .add(jLabel3))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelFicheroEntradaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanelFicheroEntradaLayout.createSequentialGroup()
                        .add(jPanelFicheroEntradaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jNImagenes)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jNImagenesASaltar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE))
                        .addContainerGap(238, Short.MAX_VALUE))
                    .add(jRutaImagenes, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE)))
            .add(jPanelFicheroEntradaLayout.createSequentialGroup()
                .add(jInverso)
                .addContainerGap())
        );
        jPanelFicheroEntradaLayout.setVerticalGroup(
            jPanelFicheroEntradaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelFicheroEntradaLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelFicheroEntradaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jPanelFicheroEntradaLayout.createSequentialGroup()
                        .add(jPanelFicheroEntradaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel8)
                            .add(jRutaImagenes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanelFicheroEntradaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jNImagenes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel3))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jNImagenesASaltar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jLabel4))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 10, Short.MAX_VALUE)
                .add(jInverso))
        );

        jPanelCondicionesParada.setBorder(javax.swing.BorderFactory.createTitledBorder("Condiciones de parada"));
        jLabel2.setText("Max Iteraciones");

        jMaxIter.setText("20000");

        jMaxError.setText("1");

        jLabel6.setText("Max Error");

        jPrecisionInicial.setText("0.1");

        jLabel5.setText("Precision Inicial");

        jMaxPrecision.setText("0.00000000000000001");

        jLabel7.setText("Max Precision");

        org.jdesktop.layout.GroupLayout jPanelCondicionesParadaLayout = new org.jdesktop.layout.GroupLayout(jPanelCondicionesParada);
        jPanelCondicionesParada.setLayout(jPanelCondicionesParadaLayout);
        jPanelCondicionesParadaLayout.setHorizontalGroup(
            jPanelCondicionesParadaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelCondicionesParadaLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelCondicionesParadaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel6)
                    .add(jLabel5)
                    .add(jLabel2)
                    .add(jLabel7))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParadaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jMaxPrecision, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
                    .add(jPrecisionInicial, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
                    .add(jMaxIter, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jMaxError, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanelCondicionesParadaLayout.setVerticalGroup(
            jPanelCondicionesParadaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelCondicionesParadaLayout.createSequentialGroup()
                .add(jPanelCondicionesParadaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel2)
                    .add(jMaxIter, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParadaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel6)
                    .add(jMaxError, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParadaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel5)
                    .add(jPrecisionInicial, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParadaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel7)
                    .add(jMaxPrecision, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanelCondicionesParada1.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros iniciales"));
        jLabel9.setText("a");

        ja.setText("0");

        jb.setText("1");

        jLabel14.setText("b");

        jc.setText("0");

        jLabel17.setText("c");

        jd.setText("0");

        jLabel18.setText("d");

        org.jdesktop.layout.GroupLayout jPanelCondicionesParada1Layout = new org.jdesktop.layout.GroupLayout(jPanelCondicionesParada1);
        jPanelCondicionesParada1.setLayout(jPanelCondicionesParada1Layout);
        jPanelCondicionesParada1Layout.setHorizontalGroup(
            jPanelCondicionesParada1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelCondicionesParada1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelCondicionesParada1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel14)
                    .add(jLabel17)
                    .add(jLabel9)
                    .add(jLabel18))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParada1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jd, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
                    .add(jc, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
                    .add(ja, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jb, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanelCondicionesParada1Layout.setVerticalGroup(
            jPanelCondicionesParada1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelCondicionesParada1Layout.createSequentialGroup()
                .add(jPanelCondicionesParada1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel9)
                    .add(ja, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParada1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel14)
                    .add(jb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParada1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel17)
                    .add(jc, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParada1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel18)
                    .add(jd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        org.jdesktop.layout.GroupLayout jPanelConfiguracionLayout = new org.jdesktop.layout.GroupLayout(jPanelConfiguracion);
        jPanelConfiguracion.setLayout(jPanelConfiguracionLayout);
        jPanelConfiguracionLayout.setHorizontalGroup(
            jPanelConfiguracionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelConfiguracionLayout.createSequentialGroup()
                .add(jPanelFicheroEntrada, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParada, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelCondicionesParada1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanelConfiguracionLayout.setVerticalGroup(
            jPanelConfiguracionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelConfiguracionLayout.createSequentialGroup()
                .add(jPanelConfiguracionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelFicheroEntrada, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanelCondicionesParada, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanelCondicionesParada1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jMenuArchivo.setText("Archivo");
        jMenuItemAbrir.setText("Abrir");
        jMenuArchivo.add(jMenuItemAbrir);

        jMenu.add(jMenuArchivo);

        jMenuCalcular.setText("Calcular");
        jMenuItemCalcularRadio.setText("Calcular Radio");
        jMenuItemCalcularRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCalcularRadioActionPerformed(evt);
            }
        });

        jMenuCalcular.add(jMenuItemCalcularRadio);

        jMenuItemCalcularTrayectoria.setText("Calcular Trayectoria");
        jMenuItemCalcularTrayectoria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCalcularTrayectoriaActionPerformed(evt);
            }
        });

        jMenuCalcular.add(jMenuItemCalcularTrayectoria);

        jMenu.add(jMenuCalcular);

        setJMenuBar(jMenu);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanelConfiguracion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanelConfiguracion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 165, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItemCalcularTrayectoriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCalcularTrayectoriaActionPerformed
        // Leemos los parametros de la configuracion
        String NombreImagenInicio=this.jRutaImagenes.getText();
        int NImagenes = Integer.parseInt(this.jNImagenes.getText());
        int NImagenesASaltar = Integer.parseInt(this.jNImagenesASaltar.getText());
        int MaxIters=Integer.parseInt(this.jMaxIter.getText());
        double PrecisionInicial=Double.parseDouble(this.jPrecisionInicial.getText());
        double IncrementoPrecision=0.9;
        double MaxPrecision=Double.parseDouble(this.jMaxPrecision.getText());
        double MaxError=Double.parseDouble(this.jMaxError.getText());
        double []parametros = new double[4];
        parametros[0]=Double.parseDouble(this.ja.getText());
        parametros[1]=Double.parseDouble(this.jb.getText());
        parametros[2]=Double.parseDouble(this.jc.getText());
        parametros[3]=Double.parseDouble(this.jd.getText());
        boolean inverso=this.jInverso.isSelected();
        
        // Creamos un objeto tipo satélite
        Satelite s1 = new Satelite(NombreImagenInicio, NImagenes, NImagenesASaltar, MaxIters, PrecisionInicial, IncrementoPrecision, MaxPrecision, MaxError, parametros, inverso);
        
        // Calculamos el radio, la trayectoria y las salidas
        s1.CalculaTrayectoria();
        int[]vector=s1.CreaImagen();
        
        // Obtenemos el radio y lo mostramos en la ventana
        Double radio = s1.getRadio();
        Double error1 = s1.getSumE1();
        Double error2 = s1.getSumE2();
        this.jRadio1.setText(radio.toString());
        this.jRadio2.setText(radio.toString());
        this.jError1.setText(error1.toString());
        this.jError2.setText(error2.toString());
        
        // Obtenemos los polinomios y los mostramos en la ventana
        this.jPolinomio1.setText(s1.getPolinomioMinimos());
        this.jPolinomio2.setText(s1.getPolinomioStepest());
        
        // Dibujamos la trayectoria
        int iniAncho=255;
        int iniAlto=255;
        Image imagenResultado = this.createImage(new MemoryImageSource(iniAncho,iniAlto,vector,0,iniAncho));
          // Escalamos la imagen
        Image imagenEscalada = imagenResultado.getScaledInstance(-(this.ImagenTrayectoria.getWidth()-50), this.ImagenTrayectoria.getHeight()-50, 1);
          // Mostramos la imagen en pantalla
        ImageIcon IconoImagen = new ImageIcon(imagenEscalada);
        this.ImagenTrayectoria.setIcon(IconoImagen);
        
    }//GEN-LAST:event_jMenuItemCalcularTrayectoriaActionPerformed

    private void jMenuItemCalcularRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCalcularRadioActionPerformed
      
    }//GEN-LAST:event_jMenuItemCalcularRadioActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new menu1().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel ImagenTrayectoria;
    private javax.swing.JLabel imagenRadio;
    private javax.swing.JLabel imagenRadio1;
    private javax.swing.JTextField jError1;
    private javax.swing.JTextField jError2;
    private javax.swing.JCheckBox jInverso;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jMaxError;
    private javax.swing.JTextField jMaxIter;
    private javax.swing.JTextField jMaxPrecision;
    private javax.swing.JMenuBar jMenu;
    private javax.swing.JMenu jMenuArchivo;
    private javax.swing.JMenu jMenuCalcular;
    private javax.swing.JMenuItem jMenuItemAbrir;
    private javax.swing.JMenuItem jMenuItemCalcularRadio;
    private javax.swing.JMenuItem jMenuItemCalcularTrayectoria;
    private javax.swing.JTextField jNImagenes;
    private javax.swing.JTextField jNImagenesASaltar;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelCondicionesParada;
    private javax.swing.JPanel jPanelCondicionesParada1;
    private javax.swing.JPanel jPanelConfiguracion;
    private javax.swing.JPanel jPanelError;
    private javax.swing.JPanel jPanelFicheroEntrada;
    private javax.swing.JPanel jPanelPolinomio;
    private javax.swing.JPanel jPanelRadio;
    private javax.swing.JTextField jPolinomio1;
    private javax.swing.JTextField jPolinomio2;
    private javax.swing.JTextField jPrecisionInicial;
    private javax.swing.JTextField jRadio1;
    private javax.swing.JTextField jRadio2;
    private javax.swing.JTextField jRutaImagenes;
    private javax.swing.JTextField ja;
    private javax.swing.JTextField jb;
    private javax.swing.JTextField jc;
    private javax.swing.JTextField jd;
    // End of variables declaration//GEN-END:variables
    
}
