svn-gvsig-desktop / trunk / libraries / libUI / src-test / org / gvsig / gui / beans / combobutton / TestComboButton.java @ 7208
History | View | Annotate | Download (1.19 KB)
1 |
package org.gvsig.gui.beans.combobutton; |
---|---|
2 |
|
3 |
import java.awt.event.ActionEvent; |
4 |
import java.awt.event.ActionListener; |
5 |
|
6 |
import javax.swing.ImageIcon; |
7 |
import javax.swing.JButton; |
8 |
import javax.swing.JFrame; |
9 |
|
10 |
import org.gvsig.gui.beans.controls.combobutton.ComboButton; |
11 |
|
12 |
public class TestComboButton { |
13 |
public static void main(String[] args) { |
14 |
JFrame frame=new JFrame(); |
15 |
ComboButton cb=new ComboButton();
|
16 |
ImageIcon icon1=new ImageIcon("images/backward.png"); |
17 |
ImageIcon icon2=new ImageIcon("images/forward.png"); |
18 |
JButton b1=new JButton(icon1); |
19 |
b1.addActionListener(new ActionListener() { |
20 |
public void actionPerformed(ActionEvent arg0) { |
21 |
System.out.println("Pulsando el bot?n 1"); |
22 |
System.out.println("Action command: "+arg0.getActionCommand()); |
23 |
} |
24 |
}); |
25 |
b1.setActionCommand("action1");
|
26 |
JButton b2=new JButton(icon2); |
27 |
b2.addActionListener(new ActionListener() { |
28 |
public void actionPerformed(ActionEvent arg0) { |
29 |
System.out.println("Pulsando el bot?n 2"); |
30 |
System.out.println("Action command: "+arg0.getActionCommand()); |
31 |
} |
32 |
}); |
33 |
b2.setActionCommand("action2");
|
34 |
cb.addButton(b1); |
35 |
cb.addButton(b2); |
36 |
frame.getContentPane().add(cb); |
37 |
frame.setSize(80,80); |
38 |
frame.setVisible(true);
|
39 |
|
40 |
} |
41 |
} |