Revision 11042 trunk/libraries/libUIComponent/src-test/org/gvsig/gui/beans/buttonsPanel/TestButtonsPanel.java
TestButtonsPanel.java | ||
---|---|---|
19 | 19 |
package org.gvsig.gui.beans.buttonsPanel; |
20 | 20 |
|
21 | 21 |
import java.awt.FlowLayout; |
22 |
import java.awt.event.ActionEvent; |
|
23 |
import java.awt.event.ActionListener; |
|
24 | 22 |
|
25 | 23 |
import javax.swing.JFrame; |
26 | 24 |
|
27 | 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 | 28 |
/** |
29 | 29 |
* <code>TestButtonsPanel</code> es un test para comprobar el funcionamiento de |
30 | 30 |
* la clase <code>ButtonsPanel</code>. |
... | ... | |
32 | 32 |
* @version 15/03/2007 |
33 | 33 |
* @author Borja Sanchez Zamorano (borja.sanchez@iver.es) |
34 | 34 |
*/ |
35 |
public class TestButtonsPanel implements ActionListener{
|
|
35 |
public class TestButtonsPanel implements ButtonsPanelListener {
|
|
36 | 36 |
private JFrame frame = new JFrame(); |
37 | 37 |
|
38 | 38 |
public TestButtonsPanel(){ |
... | ... | |
40 | 40 |
|
41 | 41 |
frame.setSize(320, 320); |
42 | 42 |
ButtonsPanel bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPT); |
43 |
bp.addActionListener(this);
|
|
43 |
bp.addButtonPressedListener(this);
|
|
44 | 44 |
frame.getContentPane().add(bp); |
45 | 45 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCEL); |
46 |
bp.addActionListener(this);
|
|
46 |
bp.addButtonPressedListener(this);
|
|
47 | 47 |
bp.setLayout(new java.awt.FlowLayout(FlowLayout.CENTER)); |
48 | 48 |
frame.getContentPane().add(bp); |
49 | 49 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY); |
50 | 50 |
bp.setLayout(new java.awt.FlowLayout(FlowLayout.LEFT)); |
51 |
bp.addActionListener(this);
|
|
51 |
bp.addButtonPressedListener(this);
|
|
52 | 52 |
frame.getContentPane().add(bp); |
53 | 53 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_YESNO); |
54 |
bp.addActionListener(this);
|
|
54 |
bp.addButtonPressedListener(this);
|
|
55 | 55 |
frame.getContentPane().add(bp); |
56 | 56 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_CLOSE); |
57 |
bp.addActionListener(this);
|
|
57 |
bp.addButtonPressedListener(this);
|
|
58 | 58 |
frame.getContentPane().add(bp); |
59 | 59 |
bp = new ButtonsPanel(ButtonsPanel.BUTTONS_EXIT); |
60 |
bp.addActionListener(this);
|
|
60 |
bp.addButtonPressedListener(this);
|
|
61 | 61 |
frame.getContentPane().add(bp); |
62 | 62 |
frame.show(); |
63 | 63 |
} |
... | ... | |
66 | 66 |
new TestButtonsPanel(); |
67 | 67 |
} |
68 | 68 |
|
69 |
public void actionPerformed(ActionEvent e) {
|
|
70 |
System.out.println(e.getActionCommand());
|
|
71 |
if (String.valueOf(ButtonsPanel.BUTTON_EXIT).compareTo(e.getActionCommand()) == 0) {
|
|
69 |
public void actionButtonPressed(ButtonsPanelEvent e) {
|
|
70 |
System.out.println(e.getButton());
|
|
71 |
if (ButtonsPanel.BUTTON_EXIT == e.getButton()) {
|
|
72 | 72 |
frame.dispose(); |
73 | 73 |
} |
74 | 74 |
} |
Also available in: Unified diff