ejemplo.grafica.java Source code

Java tutorial

Introduction

Here is the source code for ejemplo.grafica.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ejemplo;

/**
 *
 * @author carlospitre
 */
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.Painter;
import javax.swing.Timer;
import javax.swing.UIDefaults;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

public class grafica extends javax.swing.JFrame {

    /**
     * Creates new form grafica
     */
    Timer timer;

    public grafica() {

        initComponents();

        cargarbarra();
        System.out.println("HOla");

    }

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

        jComboBox1 = new javax.swing.JComboBox();
        jTextField4 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        txtTipo = new javax.swing.JTextField();
        txtPeso = new javax.swing.JTextField();
        txtNivel = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtMaxPeso = new javax.swing.JTextField();
        txtMinPeso = new javax.swing.JTextField();
        txtMinNivel = new javax.swing.JTextField();
        txtMaxNivel = new javax.swing.JTextField();
        txtMinTipo = new javax.swing.JTextField();
        txtMaxTipo = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        textAreaEntradas = new javax.swing.JTextArea();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jScrollPane4 = new javax.swing.JScrollPane();
        jPanel4 = new javax.swing.JPanel();
        panelNivel = new javax.swing.JPanel();
        panelNivelAgua = new javax.swing.JPanel();
        panelTipo = new javax.swing.JPanel();
        panelPeso = new javax.swing.JPanel();
        panelDetergente = new javax.swing.JPanel();
        panelTipoLavado = new javax.swing.JPanel();
        panelTiempoLavado = new javax.swing.JPanel();
        panelNivelAgua1 = new javax.swing.JPanel();
        progressBar = new javax.swing.JProgressBar();
        jPanel5 = new javax.swing.JPanel();
        jTabbedPane5 = new javax.swing.JTabbedPane();
        jLabel7 = new javax.swing.JLabel();
        txtMaximaAgua = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        txtNivelAgua = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        txtMaximoDetergente = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txtCantidadDetergente = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        txtMaximoTiempo = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        txtTipoLavado = new javax.swing.JTextField();
        pb = new javax.swing.JProgressBar();

        jComboBox1.setModel(
                new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTextField4.setText("jTextField1");

        jButton1.setText("Generar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Variables de Entradas"));

        txtTipo.setText("0");
        txtTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtTipoActionPerformed(evt);
            }
        });

        txtPeso.setText("0");
        txtPeso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtPesoActionPerformed(evt);
            }
        });

        txtNivel.setText("0");

        jLabel1.setText("Peso de Ropa");

        jLabel2.setText("Nivel Suciedad");

        jLabel3.setText("Tipo de Tela");

        jLabel4.setText("Universo");

        jLabel5.setText("Min");

        jLabel6.setText("Max");

        txtMaxPeso.setText("0");
        txtMaxPeso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMaxPesoActionPerformed(evt);
            }
        });

        txtMinPeso.setText("0");
        txtMinPeso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMinPesoActionPerformed(evt);
            }
        });

        txtMinNivel.setText("0");
        txtMinNivel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMinNivelActionPerformed(evt);
            }
        });

        txtMaxNivel.setText("0");
        txtMaxNivel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMaxNivelActionPerformed(evt);
            }
        });

        txtMinTipo.setText("0");
        txtMinTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMinTipoActionPerformed(evt);
            }
        });

        txtMaxTipo.setText("0");
        txtMaxTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMaxTipoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(jPanel2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup().addGroup(
                                        jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel2).addComponent(jLabel3).addComponent(jLabel1))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                        false)
                                                .addComponent(txtNivel, javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(txtPeso, javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(txtTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 47,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addComponent(txtMinTipo,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(txtMaxTipo,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addComponent(txtMinNivel,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(txtMaxNivel,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(46, 46, 46)
                                                        .addComponent(txtMaxPeso,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addComponent(txtMinPeso, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        40, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(0, 16, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout
                                        .createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                        false)
                                                .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addComponent(jLabel5,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(jLabel6)))
                                        .addGap(22, 22, 22)))));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel4).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5).addComponent(jLabel6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtPeso, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtMaxPeso, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(txtMinPeso, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(txtMaxNivel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(txtMinNivel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(txtNivel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel2)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(txtMaxTipo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(txtMinTipo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(txtTipo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel3)))
                        .addContainerGap()));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Grados de Pert. Var. Entradas"));

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

        jTabbedPane2.addTab("Entradas", jScrollPane1);

        jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jTextArea2.setText("hahahahaha\n");
        jScrollPane2.setViewportView(jTextArea2);

        jTabbedPane2.addTab("Salidas", jScrollPane2);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(jPanel1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addGap(31, 31, 31)
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jTabbedPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE)
                        .addContainerGap()));
        jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 237,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29)
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        panelNivel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelNivelLayout = new javax.swing.GroupLayout(panelNivel);
        panelNivel.setLayout(panelNivelLayout);
        panelNivelLayout.setHorizontalGroup(panelNivelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 281, Short.MAX_VALUE));
        panelNivelLayout.setVerticalGroup(panelNivelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 193, Short.MAX_VALUE));

        panelNivelAgua.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelNivelAguaLayout = new javax.swing.GroupLayout(panelNivelAgua);
        panelNivelAgua.setLayout(panelNivelAguaLayout);
        panelNivelAguaLayout.setHorizontalGroup(panelNivelAguaLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 279, Short.MAX_VALUE));
        panelNivelAguaLayout.setVerticalGroup(panelNivelAguaLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 193, Short.MAX_VALUE));

        panelTipo.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelTipoLayout = new javax.swing.GroupLayout(panelTipo);
        panelTipo.setLayout(panelTipoLayout);
        panelTipoLayout.setHorizontalGroup(panelTipoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 279, Short.MAX_VALUE));
        panelTipoLayout.setVerticalGroup(panelTipoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 193, Short.MAX_VALUE));

        panelPeso.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelPesoLayout = new javax.swing.GroupLayout(panelPeso);
        panelPeso.setLayout(panelPesoLayout);
        panelPesoLayout.setHorizontalGroup(panelPesoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 279, Short.MAX_VALUE));
        panelPesoLayout.setVerticalGroup(panelPesoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));

        panelDetergente.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelDetergenteLayout = new javax.swing.GroupLayout(panelDetergente);
        panelDetergente.setLayout(panelDetergenteLayout);
        panelDetergenteLayout.setHorizontalGroup(panelDetergenteLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 279, Short.MAX_VALUE));
        panelDetergenteLayout.setVerticalGroup(panelDetergenteLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));

        panelTipoLavado.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelTipoLavadoLayout = new javax.swing.GroupLayout(panelTipoLavado);
        panelTipoLavado.setLayout(panelTipoLavadoLayout);
        panelTipoLavadoLayout.setHorizontalGroup(panelTipoLavadoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 281, Short.MAX_VALUE));
        panelTipoLavadoLayout.setVerticalGroup(panelTipoLavadoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 193, Short.MAX_VALUE));

        panelTiempoLavado.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelTiempoLavadoLayout = new javax.swing.GroupLayout(panelTiempoLavado);
        panelTiempoLavado.setLayout(panelTiempoLavadoLayout);
        panelTiempoLavadoLayout.setHorizontalGroup(panelTiempoLavadoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 279, Short.MAX_VALUE));
        panelTiempoLavadoLayout.setVerticalGroup(panelTiempoLavadoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 193, Short.MAX_VALUE));

        panelNivelAgua1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout panelNivelAgua1Layout = new javax.swing.GroupLayout(panelNivelAgua1);
        panelNivelAgua1.setLayout(panelNivelAgua1Layout);
        panelNivelAgua1Layout.setHorizontalGroup(panelNivelAgua1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 279, Short.MAX_VALUE));
        panelNivelAgua1Layout.setVerticalGroup(panelNivelAgua1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 193, Short.MAX_VALUE));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(jPanel4Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup().addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel4Layout.createSequentialGroup()
                                                .addComponent(panelPeso, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(panelNivel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(panelTipo, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(panelNivelAgua, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addComponent(panelDetergente, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(panelTipoLavado, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(panelTiempoLavado, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(panelNivelAgua1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGap(94, 94, 94)));
        jPanel4Layout
                .setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel4Layout.createSequentialGroup().addGap(16, 16, 16)
                                .addGroup(jPanel4Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(panelNivelAgua, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(panelNivel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(panelTipo, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(panelPeso, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(16, 16, 16)
                                .addGroup(jPanel4Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(panelNivelAgua1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(panelTipoLavado, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(panelTiempoLavado, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(panelDetergente, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(346, 346, 346)));

        jPanel4Layout.linkSize(javax.swing.SwingConstants.VERTICAL,
                new java.awt.Component[] { panelNivel, panelNivelAgua, panelTipo });

        jScrollPane4.setViewportView(jPanel4);

        progressBar.setOrientation(1);
        progressBar.setStringPainted(true);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Variables de Salidas"));

        jLabel7.setText("Nivel Maximo de Agua en Lts");

        txtMaximaAgua.setText("0");
        txtMaximaAgua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMaximaAguaActionPerformed(evt);
            }
        });

        jLabel8.setText("Nivel Del Agua En Lts ");

        txtNivelAgua.setText("0");
        txtNivelAgua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNivelAguaActionPerformed(evt);
            }
        });

        jLabel9.setText("Nivel Maximo de Detergente en Gr");

        txtMaximoDetergente.setText("0");
        txtMaximoDetergente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMaximoDetergenteActionPerformed(evt);
            }
        });

        jLabel10.setText("Nivel De Detergente en Gr. ");

        txtCantidadDetergente.setText("0");
        txtCantidadDetergente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCantidadDetergenteActionPerformed(evt);
            }
        });

        jLabel11.setText("Tiempo de Lavado en Minutos");

        txtMaximoTiempo.setText("0");
        txtMaximoTiempo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMaximoTiempoActionPerformed(evt);
            }
        });

        jLabel12.setText("Tipo Lavado");

        txtTipoLavado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtTipoLavadoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(jPanel5Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup().addGroup(jPanel5Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createSequentialGroup().addGap(31, 31, 31).addComponent(
                                jTabbedPane5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(jPanel5Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel5Layout.createSequentialGroup().addComponent(jLabel8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(txtNivelAgua, javax.swing.GroupLayout.PREFERRED_SIZE, 69,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                        jPanel5Layout.createSequentialGroup().addComponent(jLabel7)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(txtMaximaAgua, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        69, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel5Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                        .addComponent(jLabel9).addGap(18, 18, 18).addComponent(txtMaximoDetergente,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 69,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel5Layout.createSequentialGroup().addComponent(jLabel11)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(txtMaximoTiempo, javax.swing.GroupLayout.PREFERRED_SIZE, 69,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel5Layout.createSequentialGroup()
                                        .addGroup(jPanel5Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel10).addComponent(jLabel12))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addGroup(jPanel5Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(txtTipoLavado).addComponent(txtCantidadDetergente,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, 69,
                                                        Short.MAX_VALUE))))))
                        .addContainerGap()));
        jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel7).addComponent(txtMaximaAgua,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel9).addComponent(txtMaximoDetergente,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel11).addComponent(txtMaximoTiempo,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel8).addComponent(txtNivelAgua,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel10).addComponent(txtCantidadDetergente,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel12)
                                .addComponent(txtTipoLavado, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(239, 239, 239)
                        .addComponent(jTabbedPane5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        pb.setOrientation(1);

        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().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup().addGroup(layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(layout.createSequentialGroup().addGap(93, 93, 93).addComponent(jButton1)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 139,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(pb, javax.swing.GroupLayout.PREFERRED_SIZE, 88,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 1191,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(14, Short.MAX_VALUE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout
                        .createSequentialGroup().addGap(116, 116, 116)
                        .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(1015, Short.MAX_VALUE))));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup().addGap(7, 7, 7)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 277,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(layout.createSequentialGroup()
                                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jButton1))
                                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 277,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(progressBar,
                                javax.swing.GroupLayout.PREFERRED_SIZE, 278,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup().addGap(148, 148, 148).addComponent(pb,
                                javax.swing.GroupLayout.PREFERRED_SIZE, 130,
                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 414,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(21, Short.MAX_VALUE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup().addGap(85, 85, 85)
                                .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(640, Short.MAX_VALUE))));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtPesoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPesoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtPesoActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (parseDouble(txtPeso.getText()) < parseDouble(txtMinPeso.getText())) {
            JOptionPane.showMessageDialog(null,
                    "El Peso de La Ropa Debe Ser Mayor Al Valor Minimo Del Conjunto Difuso", "alert",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }
        if (parseDouble(txtNivel.getText()) < parseDouble(txtMinNivel.getText())) {
            JOptionPane.showMessageDialog(null,
                    "El Nivel De Suciedad Debe Ser Mayor Al Valor Minimo Del Conjunto Difuso", "alert",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }
        if (parseDouble(txtTipo.getText()) < parseDouble(txtMinTipo.getText())) {
            JOptionPane.showMessageDialog(null,
                    "El Tipo de Ropa Debe Ser Mayor Al Valor Minimo Del Conjunto Difuso", "alert",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }
        graficaPeso();
        graficaNivel();
        graficaTipo();
        universoAgua();
        universoDetergente();
        valoresPertenecia();
        suciedad();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void universoAgua() {
        double proporcionAgua, nivelAgua;
        double peso = parseDouble(txtPeso.getText());
        double universoAgua = (parseDouble(txtMaxPeso.getText()) * 20) / 16;
        System.out.println(universoAgua);
        proporcionAgua = (peso * 100) / parseDouble(txtMaxPeso.getText());
        nivelAgua = (universoAgua * proporcionAgua) / 100;
        System.out.println(nivelAgua);
        txtNivelAgua.setText(Integer.toString((int) Math.round(nivelAgua)));
        txtMaximaAgua.setText(Integer.toString((int) Math.round(universoAgua)));
        graficarNivelAgua(nivelAgua, universoAgua);
    }

    private void universoDetergente() {
        double universoDetergente = (parseDouble(txtMaxPeso.getText()) * 250) / 16;
        txtMaximoDetergente.setText(Integer.toString((int) Math.round(universoDetergente)));
    }

    public void sistemaReglaDetergente(String[] arregloSuciedad, String[] arregloPeso) {
        double medio, valorSuciedad = parseDouble(arregloSuciedad[0]) * 100,
                valorPeso = parseDouble(arregloPeso[0]) * 100;
        double dimension, conjunto1, conjunto2, conjunto3, detergente = 0;
        medio = (valorSuciedad + valorPeso) / 2;
        dimension = parseInt(txtMaximoDetergente.getText()) / 3;
        conjunto1 = dimension;
        conjunto2 = dimension * 2;
        conjunto3 = dimension * 3;

        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Liviano") {
            //muy poco detergente
            detergente = (conjunto1 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Liviano") {
            //poco detergente
            detergente = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Liviano") {
            //mucho detergente
            detergente = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Pesado") {
            //poco detergente
            detergente = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Pesado") {
            //mucho detergente
            detergente = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Pesado") {
            //mucho detergente
            detergente = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Muy Pesado") {
            //poco detergente
            detergente = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Muy Pesado") {
            //mucho detergente
            detergente = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Muy Pesado") {
            //mucho detergente
            detergente = (conjunto3 * medio) / 100;
        }
        System.out.println(Double.toString(detergente));
        txtCantidadDetergente.setText(Double.toString(detergente));
        graficarDetergente(detergente, parseInt(txtMaximoDetergente.getText()));
    }

    public void sistemaReglaTipoLavado(String[] arregloSuciedad, String[] arregloPeso) {
        double medio, valorSuciedad = parseDouble(arregloSuciedad[0]) * 100,
                valorPeso = parseDouble(arregloPeso[0]) * 100;
        double dimension, conjunto1, conjunto2, conjunto3, tipo = 0;
        medio = (valorSuciedad + valorPeso) / 2;
        dimension = 15 / 3;
        conjunto1 = dimension;
        conjunto2 = dimension * 2;
        conjunto3 = dimension * 3;

        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Liviano") {
            //corto
            txtTipoLavado.setText("corto");
            tipo = (conjunto1 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Liviano") {
            //medio
            txtTipoLavado.setText("medio");
            tipo = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Liviano") {
            //medio
            txtTipoLavado.setText("medio");
            tipo = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Pesado") {
            //medio
            txtTipoLavado.setText("medio");
            tipo = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Pesado") {
            //medio
            txtTipoLavado.setText("medio");
            tipo = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Pesado") {
            //largo
            txtTipoLavado.setText("largo");
            tipo = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Muy Pesado") {
            //medio
            txtTipoLavado.setText("medio");
            tipo = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Muy Pesado") {
            //largo
            txtTipoLavado.setText("largo");
            tipo = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Muy Pesado") {
            //largo
            txtTipoLavado.setText("largo");
            tipo = (conjunto3 * medio) / 100;
        }
        System.out.println(Double.toString(tipo));
        graficarTipoLavado(tipo);
    }

    public void sistemaReglaTiempoLavado(String[] arregloSuciedad, String[] arregloPeso) {
        double medio, valorSuciedad = parseDouble(arregloSuciedad[0]) * 100,
                valorPeso = parseDouble(arregloPeso[0]) * 100;
        double dimension, conjunto1, conjunto2, conjunto3, tiempo = 0;
        medio = (valorSuciedad + valorPeso) / 2;
        dimension = 120 / 3;
        conjunto1 = dimension;
        conjunto2 = dimension * 2;
        conjunto3 = dimension * 3;

        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Liviano") {
            //corto
            tiempo = (conjunto1 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Liviano") {
            //medio
            tiempo = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Liviano") {
            //medio
            tiempo = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Pesado") {
            //medio
            tiempo = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Pesado") {
            //medio
            tiempo = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Pesado") {
            //largo
            tiempo = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Poco Sucia" && arregloPeso[1] == "Muy Pesado") {
            //medio
            tiempo = (conjunto2 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Sucia" && arregloPeso[1] == "Muy Pesado") {
            //largo
            tiempo = (conjunto3 * medio) / 100;
        }
        if (arregloSuciedad[1] == "Muy Sucia" && arregloPeso[1] == "Muy Pesado") {
            //largo
            tiempo = (conjunto3 * medio) / 100;
        }
        System.out.println(Double.toString(tiempo));
        txtMaximoTiempo.setText(Double.toString(tiempo));
        graficarTiempoLavado(tiempo);
    }

    public void graficarTipoLavado(double tipo) {
        double a = 0;
        double b = 15;
        XYSeries Puntos = new XYSeries("Puntos 1");
        Puntos.add(a, 0);
        Puntos.add((a + b) / 2, b);
        Puntos.add(b, 0);
        XYSeries Puntos2 = new XYSeries("Puntos 2");
        Puntos2.add(a, b);
        Puntos2.add((a + b) / 2, 0);
        Puntos2.add(b, b);
        XYSeries PuntosRecta = new XYSeries("Recta");
        PuntosRecta.add(tipo, 0);
        PuntosRecta.add(tipo, b);

        final XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(Puntos);
        dataset.addSeries(Puntos2);
        dataset.addSeries(PuntosRecta);
        JFreeChart chart = ChartFactory.createXYLineChart("Grafica Nivel del Agua", "Universo", "Grado Pertenencia",
                dataset, PlotOrientation.VERTICAL, true, true, false);
        ChartPanel panel = new ChartPanel(chart);
        panelTipoLavado.setLayout(new java.awt.BorderLayout());
        panelTipoLavado.add(panel);
        panelTipoLavado.validate();
    }

    public void graficarTiempoLavado(double tiempo) {
        double a = 0;
        double b = 120;
        XYSeries Puntos = new XYSeries("Puntos 1");
        Puntos.add(a, 0);
        Puntos.add((a + b) / 2, b);
        Puntos.add(b, 0);
        XYSeries Puntos2 = new XYSeries("Puntos 2");
        Puntos2.add(a, b);
        Puntos2.add((a + b) / 2, 0);
        Puntos2.add(b, b);
        XYSeries PuntosRecta = new XYSeries("Recta");
        PuntosRecta.add(tiempo, 0);
        PuntosRecta.add(tiempo, b);

        final XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(Puntos);
        dataset.addSeries(Puntos2);
        dataset.addSeries(PuntosRecta);
        JFreeChart chart = ChartFactory.createXYLineChart("Grafica Nivel del Agua", "Universo", "Grado Pertenencia",
                dataset, PlotOrientation.VERTICAL, true, true, false);
        ChartPanel panel = new ChartPanel(chart);
        panelTiempoLavado.setLayout(new java.awt.BorderLayout());
        panelTiempoLavado.add(panel);
        panelTiempoLavado.validate();

    }

    public void graficarNivelAgua(double nivelAgua, double universo) {
        double a = 0;
        double b = universo;
        XYSeries Puntos = new XYSeries("Puntos 1");
        Puntos.add(a, 0);
        Puntos.add((a + b) / 2, b);
        Puntos.add(b, 0);
        XYSeries Puntos2 = new XYSeries("Puntos 2");
        Puntos2.add(a, b);
        Puntos2.add((a + b) / 2, 0);
        Puntos2.add(b, b);
        XYSeries PuntosRecta = new XYSeries("Recta");
        PuntosRecta.add(nivelAgua, 0);
        PuntosRecta.add(nivelAgua, b);

        final XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(Puntos);
        dataset.addSeries(Puntos2);
        dataset.addSeries(PuntosRecta);
        JFreeChart chart = ChartFactory.createXYLineChart("Grafica Nivel del Agua", "Universo", "Grado Pertenencia",
                dataset, PlotOrientation.VERTICAL, true, true, false);
        ChartPanel panel = new ChartPanel(chart);
        panelNivelAgua.setLayout(new java.awt.BorderLayout());
        panelNivelAgua.add(panel);
        panelNivelAgua.validate();
    }

    public void cargarbarra() {
        UIDefaults defaults = new UIDefaults();
        defaults.put("ProgressBar[Enabled].foregroundPainter", new MyPainter(Color.BLUE));
        defaults.put("ProgressBar[Enabled+Finished].foregroundPainter", new MyPainter(Color.BLUE));
        progressBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
        progressBar.putClientProperty("Nimbus.Overrides", defaults);
        ActionListener updateProBar = new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                int max, min, maxD;
                min = 0;
                max = Integer.parseInt(txtMaximaAgua.getText());
                maxD = Integer.parseInt(txtMaximoDetergente.getText());
                progressBar.setMinimum(min);
                progressBar.setMaximum(max);
                int nivelDeseado = Integer.parseInt(txtNivelAgua.getText());
                int nivelActual = progressBar.getValue();
                if (nivelDeseado > nivelActual) {
                    if (nivelDeseado == nivelActual) {
                        timer.stop();
                    }
                    progressBar.setValue(++nivelActual);
                } else {
                    if (nivelDeseado < nivelActual) {

                        if (nivelDeseado == nivelActual) {
                            timer.stop();
                        }
                        progressBar.setValue(--nivelActual);
                    }
                }

            }

        };
        timer = new Timer(500, updateProBar);
        timer.start();
    }

    private String[] mayorPeso(double porcentaje, double complemento, int bandera) {
        String[] arreglo = new String[2];
        if (bandera == 0) {
            if (porcentaje > complemento) {
                arreglo[0] = Double.toString(porcentaje);
                arreglo[1] = "Pesado";
            } else {
                arreglo[0] = Double.toString(complemento);
                arreglo[1] = "Liviano";
            }
        }
        if (bandera == 1) {
            if (porcentaje > complemento) {
                arreglo[0] = Double.toString(porcentaje);
                arreglo[1] = "Pesado";
            } else {
                arreglo[0] = Double.toString(complemento);
                arreglo[1] = "Muy Pesado";
            }
        }
        return arreglo;
    }

    private String[] mayorSuciedad(double porcentaje, double complemento, int bandera) {

        String[] arreglo = new String[2];
        if (bandera == 0) {
            if (porcentaje > complemento) {
                arreglo[0] = Double.toString(porcentaje);
                arreglo[1] = "Sucia";
            } else {
                arreglo[0] = Double.toString(complemento);
                arreglo[1] = "Poco Sucia";
            }
        }
        if (bandera == 1) {
            if (porcentaje > complemento) {
                arreglo[0] = Double.toString(porcentaje);
                arreglo[1] = "Sucia";
            } else {
                arreglo[0] = Double.toString(complemento);
                arreglo[1] = "Muy Sucia";
            }
        }
        return arreglo;
    }

    private void suciedad() {

        //agregar
        double nivelSuciedad = parseDouble(txtNivel.getText());
        double min, pocosucia, sucia, muysucia, parte, max;
        max = parseDouble(txtMaxNivel.getText());
        parte = max / 3;
        min = 0;
        pocosucia = parte;
        sucia = parte * 2;
        muysucia = parte * 3;

        //niveles para el color
        //niveles normal
        if (nivelSuciedad >= min && nivelSuciedad < pocosucia) {

            UIDefaults defaults = new UIDefaults();
            defaults.put("ProgressBar[Enabled].foregroundPainter", new MyPainter(Color.BLUE));
            defaults.put("ProgressBar[Enabled+Finished].foregroundPainter", new MyPainter(Color.BLUE));
            progressBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
            progressBar.putClientProperty("Nimbus.Overrides", defaults);

        } else {
            //nivel sucio
            if (nivelSuciedad >= pocosucia && nivelSuciedad < sucia) {
                UIDefaults defaults = new UIDefaults();
                defaults.put("ProgressBar[Enabled].foregroundPainter", new MyPainter(Color.LIGHT_GRAY));
                defaults.put("ProgressBar[Enabled+Finished].foregroundPainter", new MyPainter(Color.LIGHT_GRAY));
                progressBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
                progressBar.putClientProperty("Nimbus.Overrides", defaults);
            } else {
                //nivel muy sucio
                if (nivelSuciedad >= sucia && nivelSuciedad <= muysucia) {
                    UIDefaults defaults = new UIDefaults();
                    defaults.put("ProgressBar[Enabled].foregroundPainter", new MyPainter(Color.GRAY));
                    defaults.put("ProgressBar[Enabled+Finished].foregroundPainter", new MyPainter(Color.GRAY));
                    progressBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
                    progressBar.putClientProperty("Nimbus.Overrides", defaults);
                }

            }
        }

        //fin niveles
    }

    private void valoresPertenecia() {
        double nivel = parseDouble(txtNivel.getText());
        double peso = parseDouble(txtPeso.getText());
        double tipo = parseDouble(txtTipo.getText());
        double porcentajeN, porcentajeP, porcentajeT, complementoN, complementoP, complementoT;
        double aN = parseDouble(txtMinNivel.getText()), aP = parseDouble(txtMinPeso.getText()),
                aT = parseDouble(txtMinTipo.getText());
        double bN = parseDouble(txtMaxNivel.getText()), bP = parseDouble(txtMaxPeso.getText()),
                bT = parseDouble(txtMaxTipo.getText());
        double mN = (aN + bN) / 2;
        double mP = (aP + bP) / 2;
        double mT = (aT + bT) / 2;
        String arregloSuciedad[], arregloPeso[];
        String mensajeNivel, mensajePeso, mensajeTipo, bandera;

        if (nivel >= aN && nivel <= mN) {
            porcentajeN = (nivel - aN) / (mN - aN);
            complementoN = 1 - porcentajeN;

            mensajeNivel = "El Nivel de Suciedad Pertenece en un " + Math.rint(porcentajeN * 100)
                    + "% Al Conjunto Difuso Sucia y en un " + Math.rint(complementoN * 100)
                    + "% Al Conjunto Difuso de Poco Sucia";
            arregloSuciedad = mayorSuciedad(porcentajeN, complementoN, 0);
        } else {
            porcentajeN = (bN - nivel) / (bN - mN);
            complementoN = 1 - porcentajeN;

            mensajeNivel = "El Nivel de Suciedad Pertenece en un " + Math.rint(porcentajeN * 100)
                    + "% Al Conjunto Difuso Sucia y en un " + Math.rint(complementoN * 100)
                    + "% Al Conjunto Difuso Muy Sucia ";
            arregloSuciedad = mayorSuciedad(porcentajeN, complementoN, 1);
        }
        if (peso >= aP && peso <= mP) {
            porcentajeP = (peso - aP) / (mP - aP);
            complementoP = 1 - porcentajeP;
            mensajePeso = "El Nivel de Peso Pertenece en un " + Math.rint(porcentajeP * 100)
                    + "% Al Conjunto Difuso Pesado y en un " + Math.rint(complementoP * 100)
                    + "% Al Conjunto Difuso  Liviano";
            arregloPeso = mayorPeso(porcentajeP, complementoP, 0);
        } else {
            porcentajeP = (bP - peso) / (bP - mP);
            complementoP = 1 - porcentajeP;
            mensajePeso = "El Nivel de Peso Pertenece en un " + Math.rint(porcentajeP * 100)
                    + "% Al Conjunto Difuso Pesado y en un " + Math.rint(complementoP * 100)
                    + "% Al Conjunto Difuso Muy Pesado";
            arregloPeso = mayorPeso(porcentajeP, complementoP, 1);
        }
        if (tipo >= aT && tipo <= mT) {
            porcentajeT = (tipo - aT) / (mT - aT);
            complementoT = 1 - porcentajeT;
            mensajeTipo = "El Nivel de Tipo de Ropa Pertenece en un " + Math.rint(porcentajeT * 100)
                    + "% Al Conjunto Difuso de Jeans y en un " + Math.rint(complementoT * 100)
                    + "% Al Conjunto Difuso de Algodon";
        } else {
            porcentajeT = (bT - tipo) / (bT - mT);
            complementoT = 1 - porcentajeT;
            mensajeTipo = "El Nivel de Tipo de Ropa Pertenece en un " + Math.rint(porcentajeT * 100)
                    + "% Al Conjunto Difuso de Jeans y en un " + Math.rint(complementoT * 100)
                    + "% Al Conjunto Difuso de Seda";
        }
        sistemaReglaDetergente(arregloSuciedad, arregloPeso);
        sistemaReglaTiempoLavado(arregloSuciedad, arregloPeso);
        sistemaReglaTipoLavado(arregloSuciedad, arregloPeso);
        textAreaEntradas.setText("");
        textAreaEntradas.append(mensajeNivel);
        textAreaEntradas.append(System.getProperty("line.separator"));
        textAreaEntradas.append(mensajePeso);
        textAreaEntradas.append(System.getProperty("line.separator"));
        textAreaEntradas.append(mensajeTipo);
    }

    private void graficarDetergente(double detergente, double universo) {
        double a = 0;
        double b = universo;
        XYSeries Puntos = new XYSeries("Puntos 1");
        Puntos.add(a, 0);
        Puntos.add((a + b) / 2, b);
        Puntos.add(b, 0);
        XYSeries Puntos2 = new XYSeries("Puntos 2");
        Puntos2.add(a, b);
        Puntos2.add((a + b) / 2, 0);
        Puntos2.add(b, b);
        XYSeries PuntosRecta = new XYSeries("Recta");
        PuntosRecta.add(detergente, 0);
        PuntosRecta.add(detergente, b);

        final XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(Puntos);
        dataset.addSeries(Puntos2);
        dataset.addSeries(PuntosRecta);
        JFreeChart chart = ChartFactory.createXYLineChart("Grafica Nivel Suciedad", "Universo", "Grado Pertenencia",
                dataset, PlotOrientation.VERTICAL, true, true, false);
        ChartPanel panel = new ChartPanel(chart);
        panelDetergente.setLayout(new java.awt.BorderLayout());
        panelDetergente.add(panel);
        panelDetergente.validate();
    }

    private void graficaNivel() {
        double a = parseDouble(txtMinNivel.getText());
        double b = parseDouble(txtMaxNivel.getText());
        XYSeries Puntos = new XYSeries("Puntos 1");
        Puntos.add(a, 0);
        Puntos.add((a + b) / 2, b);
        Puntos.add(b, 0);
        XYSeries Puntos2 = new XYSeries("Puntos 2");
        Puntos2.add(a, b);
        Puntos2.add((a + b) / 2, 0);
        Puntos2.add(b, b);
        XYSeries PuntosRecta = new XYSeries("Recta");
        PuntosRecta.add(parseDouble(txtNivel.getText()), 0);
        PuntosRecta.add(parseDouble(txtNivel.getText()), b);

        final XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(Puntos);
        dataset.addSeries(Puntos2);
        dataset.addSeries(PuntosRecta);
        JFreeChart chart = ChartFactory.createXYLineChart("Grafica Nivel Suciedad", "Universo", "Grado Pertenencia",
                dataset, PlotOrientation.VERTICAL, true, true, false);
        ChartPanel panel = new ChartPanel(chart);
        panelNivel.setLayout(new java.awt.BorderLayout());
        panelNivel.add(panel);
        panelNivel.validate();
    }

    private void graficaPeso() {
        double a = parseDouble(txtMinPeso.getText());
        double b = parseDouble(txtMaxPeso.getText());
        XYSeries Puntos = new XYSeries("Puntos 1");
        Puntos.add(a, 0);
        Puntos.add((a + b) / 2, b);
        Puntos.add(b, 0);
        XYSeries Puntos2 = new XYSeries("Puntos 2");
        Puntos2.add(a, b);
        Puntos2.add((a + b) / 2, 0);
        Puntos2.add(b, b);
        XYSeries PuntosRecta = new XYSeries("Recta");
        PuntosRecta.add(parseDouble(txtPeso.getText()), 0);
        PuntosRecta.add(parseDouble(txtPeso.getText()), b);

        final XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(Puntos);
        dataset.addSeries(Puntos2);
        dataset.addSeries(PuntosRecta);
        JFreeChart chart = ChartFactory.createXYLineChart("Grafica Peso Ropa", "Universo", "Grado Pertenencia",
                dataset, PlotOrientation.VERTICAL, true, true, false);
        ChartPanel panel = new ChartPanel(chart);
        panelPeso.setLayout(new java.awt.BorderLayout());
        panelPeso.add(panel);
        panelPeso.validate();
    }

    private void graficaTipo() {
        double a = parseDouble(txtMinTipo.getText());
        double b = parseDouble(txtMaxTipo.getText());
        XYSeries Puntos = new XYSeries("Puntos 1");
        Puntos.add(a, 0);
        Puntos.add((a + b) / 2, b);
        Puntos.add(b, 0);
        XYSeries Puntos2 = new XYSeries("Puntos 2");
        Puntos2.add(a, b);
        Puntos2.add((a + b) / 2, 0);
        Puntos2.add(b, b);
        XYSeries PuntosRecta = new XYSeries("Recta");
        PuntosRecta.add(parseDouble(txtTipo.getText()), 0);
        PuntosRecta.add(parseDouble(txtTipo.getText()), b);

        final XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(Puntos);
        dataset.addSeries(Puntos2);
        dataset.addSeries(PuntosRecta);
        JFreeChart chart = ChartFactory.createXYLineChart("Grafica Tipo Ropa", "Universo", "Grado Pertenencia",
                dataset, PlotOrientation.VERTICAL, true, true, false);
        ChartPanel panel = new ChartPanel(chart);
        panelTipo.setLayout(new java.awt.BorderLayout());
        panelTipo.add(panel);
        panelTipo.validate();
    }

    private void txtTipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTipoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtTipoActionPerformed

    private void txtMaxPesoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaxPesoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMaxPesoActionPerformed

    private void txtMinPesoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMinPesoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMinPesoActionPerformed

    private void txtMinNivelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMinNivelActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMinNivelActionPerformed

    private void txtMaxNivelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaxNivelActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMaxNivelActionPerformed

    private void txtMinTipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMinTipoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMinTipoActionPerformed

    private void txtMaxTipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaxTipoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMaxTipoActionPerformed

    private void txtMaximaAguaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaximaAguaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMaximaAguaActionPerformed

    private void txtNivelAguaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNivelAguaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtNivelAguaActionPerformed

    private void txtMaximoDetergenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaximoDetergenteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMaximoDetergenteActionPerformed

    private void txtCantidadDetergenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCantidadDetergenteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCantidadDetergenteActionPerformed

    private void txtMaximoTiempoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaximoTiempoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMaximoTiempoActionPerformed

    private void txtTipoLavadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTipoLavadoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtTipoLavadoActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(grafica.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(grafica.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(grafica.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(grafica.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new grafica().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    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.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTabbedPane jTabbedPane5;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JPanel panelDetergente;
    private javax.swing.JPanel panelNivel;
    private javax.swing.JPanel panelNivelAgua;
    private javax.swing.JPanel panelNivelAgua1;
    private javax.swing.JPanel panelPeso;
    private javax.swing.JPanel panelTiempoLavado;
    private javax.swing.JPanel panelTipo;
    private javax.swing.JPanel panelTipoLavado;
    private javax.swing.JProgressBar pb;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JTextArea textAreaEntradas;
    private javax.swing.JTextField txtCantidadDetergente;
    private javax.swing.JTextField txtMaxNivel;
    private javax.swing.JTextField txtMaxPeso;
    private javax.swing.JTextField txtMaxTipo;
    private javax.swing.JTextField txtMaximaAgua;
    private javax.swing.JTextField txtMaximoDetergente;
    private javax.swing.JTextField txtMaximoTiempo;
    private javax.swing.JTextField txtMinNivel;
    private javax.swing.JTextField txtMinPeso;
    private javax.swing.JTextField txtMinTipo;
    private javax.swing.JTextField txtNivel;
    private javax.swing.JTextField txtNivelAgua;
    private javax.swing.JTextField txtPeso;
    private javax.swing.JTextField txtTipo;
    private javax.swing.JTextField txtTipoLavado;
    // End of variables declaration//GEN-END:variables
}

class MyPainter implements Painter<JProgressBar> {

    private final Color color;

    public MyPainter(Color c1) {
        this.color = c1;
    }

    public void paint(Graphics2D gd, JProgressBar t, int width, int height) {
        gd.setColor(color);
        gd.fillRect(0, 0, width, height);
    }
}