/*
 * JApplet_1.java
 *
 * Created on 15 de Fevereiro de 2001, 15:51
 */


/**
 *
 * @author  Ricardo
 * @version 
 */

import java.util.Vector;
import javax.swing.*;
import java.awt.*;
//import RoundButton;

public class jList extends javax.swing.JApplet {

    public
    Vector data = new Vector();    

    /** Creates new form JApplet_1 */
    public jList() {

        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 FormEditor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        jTextField1 = new javax.swing.JTextField();
        data.addElement("Teste01");
        data.addElement("Teste02");
        data.addElement("Teste03");
        data.addElement("Teste04");
        data.addElement("Teste05");
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList(data);
        jList1.setListData(data);
        getContentPane().setLayout(null);
        
        jTextField1.setText("jTextField1");
        
        getContentPane().add(jTextField1);
        jTextField1.setBounds(28, 142, 110, 25);
        
        
        jButton1.setFont(new java.awt.Font ("Arial", 0, 11));
        jButton1.setText("Inserir");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        }
        );
        
        getContentPane().add(jButton1);
        jButton1.setBounds(190, 100, 70, 30);
        
        
        jButton2.setFont(new java.awt.Font ("Arial", 0, 11));
        jButton2.setText("Deletar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        }
        );
        
        getContentPane().add(jButton2);
        jButton2.setBounds(190, 150, 70, 30);
        
        
        
        jList1.setVisibleRowCount(4);
          jScrollPane1.setViewportView(jList1);
          
          
        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(33, 33, 132, 90);
        
    }//GEN-END:initComponents

  private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// Add your handling code here:
      int index = jList1.getSelectedIndex();
      data.remove(index);
      jList1.repaint();
      jScrollPane1.repaint();
  }//GEN-LAST:event_jButton2ActionPerformed

  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// Add your handling code here:
      String p = jTextField1.getText();
      data.add(p);
      jTextField1.setText("");
      jList1.repaint();
      jScrollPane1.repaint();
  }//GEN-LAST:event_jButton1ActionPerformed

  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JTextField jTextField1;
  private javax.swing.JButton jButton1;
  private javax.swing.JButton jButton2;
  private javax.swing.JScrollPane jScrollPane1;
  private javax.swing.JList jList1;
  // End of variables declaration//GEN-END:variables

}

