Inputs.java :  » XML-UI » xui32 » xui » samples » carousel » components » Java Open Source

Java Open Source » XML UI » xui32 
xui32 » xui » samples » carousel » components » Inputs.java
package xui.samples.carousel.components;

import com.xoetrope.swing.XBreadcrumbBar;
import com.xoetrope.swing.XPasswordDlg;
import com.xoetrope.swing.XProgressIndicator;
import com.xoetrope.swing.XReflectedImage;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import net.xoetrope.optional.annotation.Find;
import net.xoetrope.swing.XButton;
import net.xoetrope.swing.XLabel;
import net.xoetrope.swing.XPanel;
import net.xoetrope.xui.*;

/**
 * A response clasas for this page
 * <p>Copyright: Xoetrope Ltd. (c) 2001-2006</p>
 * <p>License: see license.txt</p>
 * <p>$Revision: 1.6 $</p>
 */
public class Inputs extends XPage implements ActionListener
{
  @Find
  private XPanel titlePanel;  
  @Find
  private XButton passButton;
  private XBreadcrumbBar breadcrumb;
  
  private int imageIndex = 1;
  private String[] images = { "ipod.gif", "apple.gif", "apple2.gif" };
  
  public Inputs()
  {
  }
  
  public void pageCreated()
  {
    passButton.addActionListener( this );         
    
    breadcrumb = Welcome.getBreadcrumb();
    breadcrumb.setBounds( 120, 315, 600, 20 );
    breadcrumb.setStyle( "base" );
    titlePanel.add( breadcrumb );
  }

  public void pageActivated()
  {
    breadcrumb.showEarlierLinks();
  }
  
  /**
   * Show the next image
   */
  public void nextImage()
  {
    ((XReflectedImage)findComponent( "reflectedImage" )).setAttribute( "imageName", images[ imageIndex++ ]);
    if ( imageIndex >= images.length )
      imageIndex = 0;
  }
  
  /**
   * A key on the keypad has been pressed - output the key value
   */
  public void keypadPressed()
  {
    KeyEvent ke = (KeyEvent)getCurrentEvent();
    Character c = ke.getKeyChar();
    
    XLabel keypadResult = (XLabel)findComponent( "keypadResult" );
    if ( c != KeyEvent.CHAR_UNDEFINED )
      keypadResult.setText( keypadResult.getText() + c.toString());
    else
      keypadResult.setText( "" );
  }

  public void actionPerformed( ActionEvent e )
  {
    if( e.getSource() == passButton ){
      XPasswordDlg passDlg = new XPasswordDlg();
      passDlg.showDialog( this );
    }
    else{
      JOptionPane.showMessageDialog( project.getAppFrame(),
      "Hyper-link clicked!", 
      "Message",
      JOptionPane.OK_OPTION );
    }
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.