Statistics
| Revision:

root / trunk / libraries / libUIComponent / src-test / org / gvsig / gui / beans / buttonsPanel / TestButtonsPanel.java @ 10885

History | View | Annotate | Download (2.55 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.beans.buttonsPanel;
20

    
21
import java.awt.FlowLayout;
22
import java.awt.event.ActionEvent;
23
import java.awt.event.ActionListener;
24

    
25
import javax.swing.JFrame;
26
/**
27
 * <code>TestButtonsPanel</code> es un test para comprobar el funcionamiento de
28
 * la clase <code>ButtonsPanel</code>.
29
 *
30
 * @version 15/03/2007
31
 * @author Borja Sanchez Zamorano (borja.sanchez@iver.es)
32
 */
33
public class TestButtonsPanel implements ActionListener{
34
        private JFrame frame = new JFrame();
35
        
36
        public TestButtonsPanel(){
37
                frame.getContentPane().setLayout(new java.awt.GridLayout(0, 1));
38

    
39
                frame.setSize(320, 320);
40
                ButtonsPanel bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPT);
41
                bp.addActionListener(this);
42
                frame.getContentPane().add(bp);
43
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCEL);
44
                bp.addActionListener(this);
45
                bp.setLayout(new java.awt.FlowLayout(FlowLayout.CENTER));
46
                frame.getContentPane().add(bp);
47
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY);
48
                bp.setLayout(new java.awt.FlowLayout(FlowLayout.LEFT));
49
                bp.addActionListener(this);
50
                frame.getContentPane().add(bp);
51
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_YESNO);
52
                bp.addActionListener(this);
53
                frame.getContentPane().add(bp);
54
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_CLOSE);
55
                bp.addActionListener(this);
56
                frame.getContentPane().add(bp);
57
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_EXIT);
58
                bp.addActionListener(this);
59
                frame.getContentPane().add(bp);
60
                frame.show();
61
        }
62
        
63
        public static void main(String[] args){
64
                new TestButtonsPanel();
65
        }
66

    
67
        public void actionPerformed(ActionEvent e) {
68
                System.out.println(e.getActionCommand());
69
                if (String.valueOf(ButtonsPanel.BUTTON_EXIT).compareTo(e.getActionCommand()) == 0) {
70
                        frame.dispose();
71
                }
72
        }
73
        
74
}