01: package xui.samples.carousel.components;
02:
03: import com.xoetrope.swing.XBreadcrumbBar;
04: import com.xoetrope.swing.XPasswordDlg;
05: import com.xoetrope.swing.XProgressIndicator;
06: import com.xoetrope.swing.XReflectedImage;
07: import java.awt.Component;
08: import java.awt.event.ActionEvent;
09: import java.awt.event.ActionListener;
10: import java.awt.event.KeyEvent;
11: import javax.swing.JFrame;
12: import javax.swing.JOptionPane;
13: import net.xoetrope.optional.annotation.Find;
14: import net.xoetrope.swing.XButton;
15: import net.xoetrope.swing.XLabel;
16: import net.xoetrope.swing.XPanel;
17: import net.xoetrope.xui.*;
18:
19: /**
20: * A response clasas for this page
21: * <p>Copyright: Xoetrope Ltd. (c) 2001-2006</p>
22: * <p>License: see license.txt</p>
23: * <p>$Revision: 1.6 $</p>
24: */
25: public class Inputs extends XPage implements ActionListener {
26: @Find
27: private XPanel titlePanel;
28: @Find
29: private XButton passButton;
30: private XBreadcrumbBar breadcrumb;
31:
32: private int imageIndex = 1;
33: private String[] images = { "ipod.gif", "apple.gif", "apple2.gif" };
34:
35: public Inputs() {
36: }
37:
38: public void pageCreated() {
39: passButton.addActionListener(this );
40:
41: breadcrumb = Welcome.getBreadcrumb();
42: breadcrumb.setBounds(120, 315, 600, 20);
43: breadcrumb.setStyle("base");
44: titlePanel.add(breadcrumb);
45: }
46:
47: public void pageActivated() {
48: breadcrumb.showEarlierLinks();
49: }
50:
51: /**
52: * Show the next image
53: */
54: public void nextImage() {
55: ((XReflectedImage) findComponent("reflectedImage"))
56: .setAttribute("imageName", images[imageIndex++]);
57: if (imageIndex >= images.length)
58: imageIndex = 0;
59: }
60:
61: /**
62: * A key on the keypad has been pressed - output the key value
63: */
64: public void keypadPressed() {
65: KeyEvent ke = (KeyEvent) getCurrentEvent();
66: Character c = ke.getKeyChar();
67:
68: XLabel keypadResult = (XLabel) findComponent("keypadResult");
69: if (c != KeyEvent.CHAR_UNDEFINED)
70: keypadResult.setText(keypadResult.getText() + c.toString());
71: else
72: keypadResult.setText("");
73: }
74:
75: public void actionPerformed(ActionEvent e) {
76: if (e.getSource() == passButton) {
77: XPasswordDlg passDlg = new XPasswordDlg();
78: passDlg.showDialog(this );
79: } else {
80: JOptionPane.showMessageDialog(project.getAppFrame(),
81: "Hyper-link clicked!", "Message",
82: JOptionPane.OK_OPTION);
83: }
84: }
85: }
|