/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info: http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2005, by :
* Corporate:
* EADS Astrium SAS
* EADS CRC
* Individual:
* Claude Cazenave
*
* $Id: CheckBoxListTest.java,v 1.1 2007/02/26 17:00:17 cazenave Exp $
*
* Changes
* -------
* 26 f�vr. 07 : Initial public release (CC);
*
*/
package simtools.ui.test;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import simtools.ui.CheckBoxList;
/**
* A simple application to test the CheckBoxList
*/
public class CheckBoxListTest {
public static void main (String[] args) {
final String[] listItems = {
"Wilfrid", "Nicolas", "Daniel", "Ronan",
"Oliver", "William", "Arnaud", "Anne"
};
boolean[] checkedItems= {
true, false, true, true,
false, false, true, false,
};
final CheckBoxList list = new CheckBoxList(listItems, checkedItems);
// show list
JScrollPane scroller =
new JScrollPane (list,
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
JFrame frame = new JFrame (CheckBoxListTest.class.getName());
frame.getContentPane().add (scroller);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
boolean[] res=list.getCheckedItems();
for(int i=0;i<listItems.length;i++){
System.out.println(listItems[i]+" "+res[i]);
}
System.exit(0);
}
});
}
}