/*
 * AltView2Dlg.java
 *
 * Jim Frankenberger
 * USDA-ARS, West Lafayette IN
 * jrf@purdue.edu
 *
 * Created on September 8, 2004, 2:26 PM
 */

package ex1;

import java.awt.*;

import java.util.*;

import javax.swing.*;

/**
 * This is a simple dialog window to display the processes in an operation as a vertical
 * list which make it easier to see the order than the table layout.
 *
 * @author  jrf
 */
public class AltView2Dlg extends javax.swing.JDialog {
    private static final long serialVersionUID = 1L;
    
    Vector<String> items;
    
    /** Creates new form JDialog
	 * @param parent
	 * @param title
	 * @param modal */
    public AltView2Dlg(java.awt.Frame parent, boolean modal, String title) {
        super(parent, modal);
        initComponents();
        items = new Vector<String>();
        setTitle(title);
        jList1.setBackground(Color.PINK);
    }
    
    /**
     * Adds a process to the string/vector list that will be displayed
     *
     * @param val the string to add to the list
     */
    public void addItem(String val) {
       items.addElement(val);
    }
    
    /**
     * Attaches the list (vector) to the JList GUI.
     *
     */
    public void setModel() {
        jList1.setListData(items);
     
    }
    
    /** 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() {

        jList1 = new javax.swing.JList<String>();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jList1.setMinimumSize(new java.awt.Dimension(200, 200));
        jList1.setPreferredSize(new java.awt.Dimension(200, 200));
        getContentPane().add(jList1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        new JDialog(new javax.swing.JFrame(), true).setVisible(true);
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JList<String> jList1;
    // End of variables declaration//GEN-END:variables
    
}
