Statistics
| Revision:

root / trunk / libraries / libUIComponent / src-test-ui / org / gvsig / gui / beans / buttonspanel / TestButtonsPanel.java @ 17644

History | View | Annotate | Download (2.74 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

    
23
import org.gvsig.gui.beans.TestUI;
24
/**
25
 * <code>TestButtonsPanel</code> es un test para comprobar el funcionamiento de
26
 * la clase <code>ButtonsPanel</code>.
27
 *
28
 * @version 15/03/2007
29
 * @author BorSanZa - Borja Sanchez Zamorano (borja.sanchez@iver.es)
30
 */
31
public class TestButtonsPanel implements ButtonsPanelListener {
32
        private TestUI frame = new TestUI("TestButtonsPanel");
33

    
34
        public TestButtonsPanel(){
35
                frame.getContentPane().setLayout(new java.awt.GridLayout(0, 1));
36

    
37
                frame.setSize(320, 320);
38
                ButtonsPanel bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPT);
39
                bp.addButtonPressedListener(this);
40
                frame.getContentPane().add(bp);
41
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCEL);
42
                bp.addButtonPressedListener(this);
43
                bp.setLayout(new java.awt.FlowLayout(FlowLayout.CENTER));
44
                frame.getContentPane().add(bp);
45
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY);
46
                bp.setLayout(new java.awt.FlowLayout(FlowLayout.LEFT));
47
                bp.addButtonPressedListener(this);
48
                frame.getContentPane().add(bp);
49
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_YESNO);
50
                bp.addButtonPressedListener(this);
51

    
52
                bp.getButton(ButtonsPanel.BUTTONS_YESNO).setEnabled(false);
53

    
54
                frame.getContentPane().add(bp);
55
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_CLOSE);
56
                bp.addButtonPressedListener(this);
57
                frame.getContentPane().add(bp);
58
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_EXIT);
59
                bp.addButtonPressedListener(this);
60
                bp.addButton("1", 55);
61
                bp.addButton("bp.addButtonPressedListener(this);", 56);
62

    
63
//                bp.getButton(ButtonsPanel.BUTTON_ACCEPT).isEnabled();
64

    
65
                frame.getContentPane().add(bp);
66
                frame.setVisible(true);
67
        }
68

    
69
        public static void main(String[] args){
70
                new TestButtonsPanel();
71
        }
72

    
73
        public void actionButtonPressed(ButtonsPanelEvent e) {
74
                System.out.println(e.getButton());
75
                if (ButtonsPanel.BUTTON_EXIT == e.getButton()) {
76
                        frame.dispose();
77
                }
78
        }
79
}