Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / test / java / org / gvsig / gui / beans / buttonspanel / TestButtonsPanel.java @ 40561

History | View | Annotate | Download (2.84 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.gui.beans.buttonspanel;
25

    
26
import java.awt.FlowLayout;
27

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

    
39
        public TestButtonsPanel(){
40
                frame.getContentPane().setLayout(new java.awt.GridLayout(0, 1));
41

    
42
                frame.setSize(320, 320);
43
                ButtonsPanel bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPT);
44
                bp.addButtonPressedListener(this);
45
                frame.getContentPane().add(bp);
46
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCEL);
47
                bp.addButtonPressedListener(this);
48
                bp.setLayout(new java.awt.FlowLayout(FlowLayout.CENTER));
49
                frame.getContentPane().add(bp);
50
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY);
51
                bp.setLayout(new java.awt.FlowLayout(FlowLayout.LEFT));
52
                bp.addButtonPressedListener(this);
53
                frame.getContentPane().add(bp);
54
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_YESNO);
55
                bp.addButtonPressedListener(this);
56

    
57
                bp.getButton(ButtonsPanel.BUTTONS_YESNO).setEnabled(false);
58

    
59
                frame.getContentPane().add(bp);
60
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_CLOSE);
61
                bp.addButtonPressedListener(this);
62
                frame.getContentPane().add(bp);
63
                bp = new ButtonsPanel(ButtonsPanel.BUTTONS_EXIT);
64
                bp.addButtonPressedListener(this);
65
                bp.addButton("1", 55);
66
                bp.addButton("bp.addButtonPressedListener(this);", 56);
67

    
68
//                bp.getButton(ButtonsPanel.BUTTON_ACCEPT).isEnabled();
69

    
70
                frame.getContentPane().add(bp);
71
                frame.setVisible(true);
72
        }
73

    
74
        public static void main(String[] args){
75
                new TestButtonsPanel();
76
        }
77

    
78
        public void actionButtonPressed(ButtonsPanelEvent e) {
79
                System.out.println(e.getButton());
80
                if (ButtonsPanel.BUTTON_EXIT == e.getButton()) {
81
                        frame.dispose();
82
                }
83
        }
84
}