Source Code : factorial

factorial

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.event.*;

/**

* Summary description for fac

*

*/

public class fac extends JFrame

{

  // Variables declaration

  private JTabbedPane jTabbedPane1;

  private JPanel contentPane;

  //-----

  private JLabel jLabel5;

  private JLabel jLabel4;

  private JLabel jLabel6;

  private JLabel jLabel7;

  private JTextField jText;

  private JTextField jText1;

  private JComboBox jCombo1;

  private JTextPane jTextPane1;

  private JScrollPane jScrollPane3;

  private JPanel jPanel1;

  //-----

  // End of variables declaration

  public fac()

  {

  super();

  initializeComponent();

  //

  // TODO: Add any constructor code after initializeComponent call

  //

  this.setVisible(true);

  }

  /**

  * This method is called from within the constructor to initialize the form.

  * WARNING: Do NOT modify this code. The content of this method is always regenerated

  * by the Windows Form Designer. Otherwise, retrieving design might not work properly.

  * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder

  * to retrieve your design properly in future, before revising this method.

  */

  private void initializeComponent()

  {

  jTabbedPane1 = new JTabbedPane();

  contentPane = (JPanel)this.getContentPane();

  //-----

  jLabel5 = new JLabel();

  jLabel4 = new JLabel();

  jLabel6 = new JLabel();

  jLabel7 = new JLabel();

  jText = new JTextField();

  jText1 = new JTextField();

  jCombo1 = new JComboBox();

  jTextPane1 = new JTextPane();

  jScrollPane3 = new JScrollPane();

  jPanel1 = new JPanel();

  //-----

  //

  // jTabbedPane1

  //

  jTabbedPane1.addTab("jPanel1", jPanel1);

  jTabbedPane1.addChangeListener(new ChangeListener() {

  public void stateChanged(ChangeEvent e)

  {

    jTabbedPane1_stateChanged(e);

  }

  });

  //

  // contentPane

  //

  contentPane.setLayout(null);

  addComponent(contentPane, jTabbedPane1, 243,102,596,318);

  //

  // jLabel5

  //

  jLabel5.setText("No.");

  //

  // jLabel4

  //

  jLabel4.setText("Name");

  //

  // jLabel6

  //

  jLabel6.setText("Depart");

  //

  // jLabel7

  //

  jLabel7.setText("Designation");

  //

  // jText

  //

  jText.setText("jTextField2");

  jText.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e)

  {

  jText_actionPerformed(e);

  }

  });

  //

  // jText1

  //

  jText1.setText("jTextField3");

  jText1.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e)

  {

  jText1_actionPerformed(e);

  }

  });

  //

  // jCombo1

  //

  jCombo1.addActionListener(new ActionListener() {

  public void actionPerformed(ActionEvent e)

  {

  jCombo1_actionPerformed(e);

  }

  });

  //

  // jTextPane1

  //

  jTextPane1.setText("fgjhfgjg");

  //

  // jScrollPane3

  //

  jScrollPane3.setViewportView(jTextPane1);

  //

  // jPanel1

  //

  jPanel1.setLayout(null);

  jPanel1.setBackground(new Color(140, 133, 93));

  jPanel1.setOpaque(false);

  addComponent(jPanel1, jLabel5, 16,19,22,18);

  addComponent(jPanel1, jLabel4, 130,18,33,18);

  addComponent(jPanel1, jLabel6, 359,17,40,18);

  addComponent(jPanel1, jLabel7, 15,55,60,18);

  addComponent(jPanel1, jText, 70,17,48,22);

  addComponent(jPanel1, jText1, 170,16,178,21);

  addComponent(jPanel1, jCombo1, 402,15,175,22);

  addComponent(jPanel1, jScrollPane3, 85,56,266,66);

  //

  // fac

  //

  this.setTitle("fac - extends JFrame");

  this.setLocation(new Point(-159, 16));

  this.setSize(new Dimension(888, 560));

  }

  /** Add Component Without a Layout Manager (Absolute Positioning) */

  private void addComponent(Container container,Component c,int x,int y,int width,int height)

  {

  c.setBounds(x,y,width,height);

  container.add(c);

  }

  //

  // TODO: Add any appropriate code in the following Event Handling Methods

  //

  private void jTabbedPane1_stateChanged(ChangeEvent e)

  {

  System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");

  // TODO: Add any handling code here

  }

  private void jText_actionPerformed(ActionEvent e)

  {

  System.out.println("\njText_actionPerformed(ActionEvent e) called.");

  // TODO: Add any handling code here

  }

  private void jText1_actionPerformed(ActionEvent e)

  {

  System.out.println("\njText1_actionPerformed(ActionEvent e) called.");

  // TODO: Add any handling code here

  }

  private void jCombo1_actionPerformed(ActionEvent e)

  {

  System.out.println("\njCombo1_actionPerformed(ActionEvent e) called.");

 

  Object o = jCombo1.getSelectedItem();

  System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");

  // TODO: Add any handling code here for the particular object being selected

 

  }

  //

  // TODO: Add any method code to meet your needs in the following area

  //

//============================= Testing ================================//

//=  =//

//= The following main method is just for testing this class you built.=//

//= After testing,you may simply delete it.  =//

//======================================================================//

  public static void main(String[] args)

  {

  JFrame.setDefaultLookAndFeelDecorated(true);

  JDialog.setDefaultLookAndFeelDecorated(true);

  try

  {

  UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

  }

  catch (Exception ex)

  {

  System.out.println("Failed loading L&F: ");

  System.out.println(ex);

  }

  new fac();

  }

//= End of Testing =

}