Statistics
| Revision:

root / trunk / libraries / libUIComponent / src-test / org / gvsig / gui / beans / dialogPanel / TestDialogPanel.java @ 11042

History | View | Annotate | Download (2.49 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.dialogPanel;
20

    
21
import java.awt.BorderLayout;
22

    
23
import javax.swing.JButton;
24
import javax.swing.JFrame;
25
import javax.swing.UIManager;
26

    
27
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
28
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
29
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
30
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel;
31
/**
32
 * <code>TestDialogPanel</code>. Test para comprobar el funcionamiento de la
33
 * clase <code>DialogPanel</code>
34
 * 
35
 * @version 15/03/2007
36
 * @author Borja Sanchez Zamorano (borja.sanchez@iver.es)
37
 */
38
public class TestDialogPanel implements ButtonsPanelListener {
39
        private JFrame frame = new JFrame();
40

    
41
        class NewComponentDialog extends DefaultButtonsPanel {
42
                private static final long serialVersionUID = 4452922507292538671L;
43

    
44
                public NewComponentDialog() {
45
                        super(ButtonsPanel.BUTTONS_YESNO);
46
                        this.setLayout(new BorderLayout());
47
                        JButton b = new JButton("prueba");
48
                        this.add(b, java.awt.BorderLayout.NORTH);
49
                        JButton c = new JButton("prueba2");
50
                        this.add(c, java.awt.BorderLayout.CENTER);
51
                }
52
        }
53

    
54
        NewComponentDialog ncd;
55

    
56
        public TestDialogPanel() {
57
                ncd = new NewComponentDialog();
58

    
59
                frame.setSize(640, 480);
60
                frame.getContentPane().add(ncd);
61
                frame.show();
62

    
63
                ncd.addButtonPressedListener(this);
64
        }
65

    
66
        public static void main(String[] args) {
67
                try {
68
                        UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
69
                } catch (Exception e) {
70
                        System.err.println("No se puede cambiar al LookAndFeel");
71
                }
72
                new TestDialogPanel();
73
        }
74

    
75
        public void actionButtonPressed(ButtonsPanelEvent e) {
76
                System.out.println("Bot?n pulsado: " + e.getButton());
77
        }
78
}