Charmouh Abdellah TP CALCULATRICE

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

UMP_ESTO_GI_GIE2_S03

Charmouh Abdellah
TP Calculatric Java:
Execution:

Code Source:
package com.mycompany.calcul;

/**

* @author user

*/

public class calcul extends javax.swing.JFrame {

/**
* Creates new form calcul

*/

public calcul() {

initComponents();

jRadioButton1.setEnabled(false);

jRadioButton2.setEnabled(true);

double num1,num2,result;

String opr;

public void enable()

jTextField1.setEnabled(true);

jRadioButton1.setEnabled(false);

jRadioButton2.setEnabled(true);

jButton40.setEnabled(true);

public void disable()

jTextField1.setEnabled(false);

jRadioButton1.setEnabled(true);

jRadioButton2.setEnabled(false);
jButton40.setEnabled(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 Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jTextField1 = new javax.swing.JTextField();

jRadioButton1 = new javax.swing.JRadioButton();

jRadioButton2 = new javax.swing.JRadioButton();

jButton40 = new javax.swing.JButton();

jButton41 = new javax.swing.JButton();

jButton42 = new javax.swing.JButton();

jButton43 = new javax.swing.JButton();

jButton44 = new javax.swing.JButton();

jButton47 = new javax.swing.JButton();

jButton48 = new javax.swing.JButton();

jButton49 = new javax.swing.JButton();

jButton50 = new javax.swing.JButton();

jButton51 = new javax.swing.JButton();

jButton54 = new javax.swing.JButton();


jButton55 = new javax.swing.JButton();

jButton56 = new javax.swing.JButton();

jButton57 = new javax.swing.JButton();

jButton58 = new javax.swing.JButton();

jButton61 = new javax.swing.JButton();

jButton62 = new javax.swing.JButton();

jButton63 = new javax.swing.JButton();

jButton64 = new javax.swing.JButton();

jButton65 = new javax.swing.JButton();

jButton68 = new javax.swing.JButton();

jButton69 = new javax.swing.JButton();

jButton70 = new javax.swing.JButton();

jButton71 = new javax.swing.JButton();

jButton72 = new javax.swing.JButton();

jButton73 = new javax.swing.JButton();

jButton75 = new javax.swing.JButton();

jButton76 = new javax.swing.JButton();

jButton77 = new javax.swing.JButton();

jButton78 = new javax.swing.JButton();

jButton79 = new javax.swing.JButton();

jButton80 = new javax.swing.JButton();

jButton82 = new javax.swing.JButton();

jButton83 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("calcul");

setResizable(false);
setType(java.awt.Window.Type.UTILITY);

jTextField1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jTextField1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

jRadioButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jRadioButton1.setText("ON");

jRadioButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jRadioButton1ActionPerformed(evt);

});

jRadioButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jRadioButton2.setText("OFF");

jRadioButton2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jRadioButton2ActionPerformed(evt);

});

jButton40.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton40.setText("1/x");

jButton40.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton40ActionPerformed(evt);

}
});

jButton41.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton41.setText("R");

jButton41.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton41ActionPerformed(evt);

});

jButton42.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton42.setText("x^3");

jButton42.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton42ActionPerformed(evt);

});

jButton43.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton43.setText("x^y");

jButton43.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton43ActionPerformed(evt);

});

jButton44.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jButton44.setText("x^2");

jButton44.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton44ActionPerformed(evt);

});

jButton47.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton47.setText("log");

jButton47.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton47ActionPerformed(evt);

});

jButton48.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton48.setText("exp");

jButton48.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton48ActionPerformed(evt);

});

jButton49.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton49.setText("7");

jButton49.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {


jButton49ActionPerformed(evt);

});

jButton50.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton50.setText("%");

jButton50.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton50ActionPerformed(evt);

});

jButton51.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton51.setText("4");

jButton51.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton51ActionPerformed(evt);

});

jButton54.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton54.setText("sinh");

jButton54.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton54ActionPerformed(evt);

});
jButton55.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton55.setText("sin");

jButton55.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton55ActionPerformed(evt);

});

jButton56.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton56.setText("8");

jButton56.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton56ActionPerformed(evt);

});

jButton57.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton57.setText("Clr");

jButton57.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton57ActionPerformed(evt);

});

jButton58.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton58.setText("5");
jButton58.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton58ActionPerformed(evt);

});

jButton61.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton61.setText("cosh");

jButton61.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton61ActionPerformed(evt);

});

jButton62.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton62.setText("cos");

jButton62.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton62ActionPerformed(evt);

});

jButton63.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton63.setText("9");

jButton63.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton63ActionPerformed(evt);
}

});

jButton64.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton64.setText("B");

jButton64.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton64ActionPerformed(evt);

});

jButton65.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton65.setText("6");

jButton65.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton65ActionPerformed(evt);

});

jButton68.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton68.setText("tanh");

jButton68.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton68ActionPerformed(evt);

});
jButton69.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton69.setText("tan");

jButton69.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton69ActionPerformed(evt);

});

jButton70.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton70.setText("-");

jButton70.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton70ActionPerformed(evt);

});

jButton71.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton71.setText("+");

jButton71.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton71ActionPerformed(evt);

});

jButton72.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton72.setText("*");

jButton72.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton72ActionPerformed(evt);

});

jButton73.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton73.setText("2");

jButton73.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton73ActionPerformed(evt);

});

jButton75.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton75.setText(".");

jButton75.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton75ActionPerformed(evt);

});

jButton76.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton76.setText("3");

jButton76.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton76ActionPerformed(evt);

}
});

jButton77.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton77.setText("n!");

jButton77.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton77ActionPerformed(evt);

});

jButton78.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton78.setText("=");

jButton78.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton78ActionPerformed(evt);

});

jButton79.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton79.setText("+/-");

jButton79.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton79ActionPerformed(evt);

});

jButton80.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jButton80.setText("/");

jButton80.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton80ActionPerformed(evt);

});

jButton82.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton82.setText("1");

jButton82.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton82ActionPerformed(evt);

});

jButton83.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton83.setText("0");

jButton83.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton83ActionPerformed(evt);

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jTextField1)

.addContainerGap())

.addGroup(layout.createSequentialGroup()

.addGap(23, 23, 23)

.addComponent(jRadioButton1)

.addGap(30, 30, 30)

.addComponent(jRadioButton2)

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jButton41)

.addComponent(jButton40)

.addComponent(jButton43)

.addComponent(jButton42)

.addComponent(jButton44))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jButton48)

.addComponent(jButton47)

.addComponent(jButton49, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton50, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jButton51, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jButton57, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jButton55)

.addComponent(jButton54)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)

.addComponent(jButton58, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)

.addComponent(jButton56, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)))

.addGap(0, 0, Short.MAX_VALUE)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jButton62)

.addComponent(jButton61, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jButton64, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jButton63, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton65, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jButton69)

.addComponent(jButton68)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)

.addComponent(jButton72, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)

.addComponent(jButton70, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)

.addComponent(jButton71, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addGroup(layout.createSequentialGroup()

.addComponent(jButton79, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton77, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGap(6, 6, 6)))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()
.addComponent(jButton82, javax.swing.GroupLayout.PREFERRED_SIZE, 57,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jButton73, javax.swing.GroupLayout.PREFERRED_SIZE, 57,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton76, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton80, javax.swing.GroupLayout.PREFERRED_SIZE, 69,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton83)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton75, javax.swing.GroupLayout.PREFERRED_SIZE, 77,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jButton78, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))

.addGap(131, 131, 131))))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 62,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jRadioButton1)

.addComponent(jRadioButton2))
.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jButton41, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton40, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton43, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton42, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton44, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton51, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton55, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton54, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton57, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton56, javax.swing.GroupLayout.PREFERRED_SIZE, 47,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(1, 1, 1)

.addComponent(jButton58, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton69, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton68, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton71, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton70, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton62, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton61, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton64, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton63, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton65, javax.swing.GroupLayout.PREFERRED_SIZE, 47,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton72, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton48, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton47, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton50, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton49, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton77, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton82, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addComponent(jButton73, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton76, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton80, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton79, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton83, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton75, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton78, javax.swing.GroupLayout.PREFERRED_SIZE, 47,


javax.swing.GroupLayout.PREFERRED_SIZE)))

.addContainerGap(64, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {

enable();

private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {

disable();

private void jButton40ActionPerformed(java.awt.event.ActionEvent evt) {

double t = 1/(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

}
private void jButton41ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Math.sqrt(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

private void jButton42ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Double.parseDouble(jTextField1.getText());

t=t*t*t;

jTextField1.setText("");

jTextField1.setText(jTextField1.getText() + t);

private void jButton43ActionPerformed(java.awt.event.ActionEvent evt) {

num1= Double.parseDouble(jTextField1.getText());

jTextField1.setText("");

opr="x^y";

private void jButton44ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Double.parseDouble(jTextField1.getText());

t=t*t;

jTextField1.setText("");

jTextField1.setText(jTextField1.getText() + t);

}
private void jButton47ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Math.log(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

private void jButton48ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Math.exp(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

private void jButton49ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"7");

private void jButton50ActionPerformed(java.awt.event.ActionEvent evt) {

num1= Double.parseDouble(jTextField1.getText());

jTextField1.setText("");

opr="%";

private void jButton51ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"4");

private void jButton54ActionPerformed(java.awt.event.ActionEvent evt) {


double t = Math.sinh(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

private void jButton55ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Math.sin(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

private void jButton56ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"8");

private void jButton57ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText("");

private void jButton58ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"5");

private void jButton61ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Math.cosh(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );
}

private void jButton62ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Math.cos(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

private void jButton63ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"9");

private void jButton64ActionPerformed(java.awt.event.ActionEvent evt) {

String backSpace = null;

if(jTextField1.getText().length() > 0)

StringBuilder s= new StringBuilder(jTextField1.getText());

s.deleteCharAt(jTextField1.getText().length()-1);

backSpace = s.toString();

jTextField1.setText(backSpace);

private void jButton65ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"6");

}
private void jButton68ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Math.tanh(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

private void jButton69ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Math.tan(Double.parseDouble(jTextField1.getText()));

jTextField1.setText("");

jTextField1.setText(jTextField1.getText()+ t );

private void jButton70ActionPerformed(java.awt.event.ActionEvent evt) {

num1= Double.parseDouble(jTextField1.getText());

jTextField1.setText("");

opr="-";

private void jButton71ActionPerformed(java.awt.event.ActionEvent evt) {

num1= Double.parseDouble(jTextField1.getText());

jTextField1.setText("");

opr="+";

private void jButton72ActionPerformed(java.awt.event.ActionEvent evt) {

num1= Double.parseDouble(jTextField1.getText());

jTextField1.setText("");
opr="*";

private void jButton73ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"2");

private void jButton75ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+".");

private void jButton76ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"3");

private void jButton77ActionPerformed(java.awt.event.ActionEvent evt) {

double t = Double.parseDouble(jTextField1.getText());

double fact =1;

while(t!=0){

fact = fact*t;

t--;

jTextField1.setText("");

jTextField1.setText(jTextField1.getText() + fact);

}
private void jButton78ActionPerformed(java.awt.event.ActionEvent evt) {

num2= Double.parseDouble(jTextField1.getText());

if(opr=="+")

result = num1 + num2 ;

jTextField1.setText(Double.toString(result));

else if(opr=="-") {

result = num1-num2 ;

jTextField1.setText(Double.toString(result));

else if(opr=="*") {

result = num1*num2 ;

jTextField1.setText(Double.toString(result));

else if(opr=="/") {

result = num1/num2 ;

jTextField1.setText(Double.toString(result));

else if(opr=="%") {

result = num1%num2 ;

jTextField1.setText(Double.toString(result));

else if (opr=="x^y")

for(int i = 0 ; i< num2 ; i++){

result = num1* num2 ;


}

jTextField1.setText(Double.toString(result));

private void jButton79ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

private void jButton80ActionPerformed(java.awt.event.ActionEvent evt) {

num1= Double.parseDouble(jTextField1.getText());

jTextField1.setText("");

opr="/";

private void jButton82ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"1");

private void jButton83ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText(jTextField1.getText()+"0");

/**

* @param args the command line arguments

*/
public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(calcul.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(calcul.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(calcul.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(calcul.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

//</editor-fold>
/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new calcul().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JButton jButton40;

private javax.swing.JButton jButton41;

private javax.swing.JButton jButton42;

private javax.swing.JButton jButton43;

private javax.swing.JButton jButton44;

private javax.swing.JButton jButton47;

private javax.swing.JButton jButton48;

private javax.swing.JButton jButton49;

private javax.swing.JButton jButton50;

private javax.swing.JButton jButton51;

private javax.swing.JButton jButton54;

private javax.swing.JButton jButton55;

private javax.swing.JButton jButton56;

private javax.swing.JButton jButton57;

private javax.swing.JButton jButton58;

private javax.swing.JButton jButton61;

private javax.swing.JButton jButton62;

private javax.swing.JButton jButton63;


private javax.swing.JButton jButton64;

private javax.swing.JButton jButton65;

private javax.swing.JButton jButton68;

private javax.swing.JButton jButton69;

private javax.swing.JButton jButton70;

private javax.swing.JButton jButton71;

private javax.swing.JButton jButton72;

private javax.swing.JButton jButton73;

private javax.swing.JButton jButton75;

private javax.swing.JButton jButton76;

private javax.swing.JButton jButton77;

private javax.swing.JButton jButton78;

private javax.swing.JButton jButton79;

private javax.swing.JButton jButton80;

private javax.swing.JButton jButton82;

private javax.swing.JButton jButton83;

private javax.swing.JRadioButton jRadioButton1;

private javax.swing.JRadioButton jRadioButton2;

private javax.swing.JTextField jTextField1;

// End of variables declaration

You might also like