root / trunk / libraries / libUIComponent / src-test / org / gvsig / gui / beans / buttonsPanel / TestButtonsPanel.java @ 11042
History | View | Annotate | Download (2.67 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 javax.swing.JFrame; |
24 |
|
25 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
26 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
27 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
28 |
/**
|
29 |
* <code>TestButtonsPanel</code> es un test para comprobar el funcionamiento de
|
30 |
* la clase <code>ButtonsPanel</code>.
|
31 |
*
|
32 |
* @version 15/03/2007
|
33 |
* @author Borja Sanchez Zamorano (borja.sanchez@iver.es)
|
34 |
*/
|
35 |
public class TestButtonsPanel implements ButtonsPanelListener { |
36 |
private JFrame frame = new JFrame(); |
37 |
|
38 |
public TestButtonsPanel(){
|
39 |
frame.getContentPane().setLayout(new java.awt.GridLayout(0, 1)); |
40 |
|
41 |
frame.setSize(320, 320); |
42 |
ButtonsPanel bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPT);
|
43 |
bp.addButtonPressedListener(this);
|
44 |
frame.getContentPane().add(bp); |
45 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCEL);
|
46 |
bp.addButtonPressedListener(this);
|
47 |
bp.setLayout(new java.awt.FlowLayout(FlowLayout.CENTER)); |
48 |
frame.getContentPane().add(bp); |
49 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY);
|
50 |
bp.setLayout(new java.awt.FlowLayout(FlowLayout.LEFT)); |
51 |
bp.addButtonPressedListener(this);
|
52 |
frame.getContentPane().add(bp); |
53 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_YESNO);
|
54 |
bp.addButtonPressedListener(this);
|
55 |
frame.getContentPane().add(bp); |
56 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_CLOSE);
|
57 |
bp.addButtonPressedListener(this);
|
58 |
frame.getContentPane().add(bp); |
59 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_EXIT);
|
60 |
bp.addButtonPressedListener(this);
|
61 |
frame.getContentPane().add(bp); |
62 |
frame.show(); |
63 |
} |
64 |
|
65 |
public static void main(String[] args){ |
66 |
new TestButtonsPanel();
|
67 |
} |
68 |
|
69 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
70 |
System.out.println(e.getButton());
|
71 |
if (ButtonsPanel.BUTTON_EXIT == e.getButton()) {
|
72 |
frame.dispose(); |
73 |
} |
74 |
} |
75 |
|
76 |
} |