Java dasurlash tilining Swing moduli yordamida Sodda Kalkulyator
Download 36.22 Kb.
|
1-dedline(Sodda kalkulyator)
- Bu sahifa navigatsiya:
- Sodda Kalkulyator
Java dasurlash tilining Swing moduli yordamida “Sodda Kalkulyator” yaratish. Men o’zimga qulay bo’lganligi uchun Java dasurlash tilining Swing moduli yordamida “ Apache Netbeans IDE” muhitidan foydalanaman. Kerakli jihozlar: JFrame , JTextField, JButton;
private void initComponents() { oyna_1 = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); oyna_2 = new javax.swing.JTextField(); qushish = new javax.swing.JButton(); ayirish = new javax.swing.JButton(); kopaytirish = new javax.swing.JButton(); bolish = new javax.swing.JButton(); natija = new javax.swing.JLabel(); tozalash = new javax.swing.JButton(); double a,b,c; private void qushishActionPerformed(java.awt.event.ActionEvent evt) { a = Double.parseDouble(oyna_1.getText()); b = Double.parseDouble(oyna_2.getText()); c = a+b; natija.setText("Natija: " + String.valueOf(c)); oyna_1.requestFocus } private void ayirishActionPerformed(java.awt.event.ActionEvent evt) { a = Double.parseDouble(oyna_1.getText()); b = Double.parseDouble(oyna_2.getText()); c = a-b; natija.setText("Natija: " + String.valueOf(c)); oyna_1.requestFocus(); } private void kopaytirishActionPerformed(java.awt.event.ActionEvent evt) { a = Double.parseDouble(oyna_1.getText()); b = Double.parseDouble(oyna_2.getText()); c = a*b; natija.setText("Natija: " + String.valueOf(c)); oyna_1.requestFocus(); } private void bolishActionPerformed(java.awt.event.ActionEvent evt) { a = Double.parseDouble(oyna_1.getText()); b = Double.parseDouble(oyna_2.getText()); c = a/b; natija.setText("Natija: " + String.valueOf(c)); oyna_1.requestFocus(); } private void oyna_1ActionPerformed(java.awt.event.ActionEvent evt) { } private void tozalashActionPerformed(java.awt.event.ActionEvent evt) { oyna_1.setText(" "); oyna_2.setText(" "); natija.setText(" "); oyna_1.requestFocus(); } private javax.swing.JButton ayirish; private javax.swing.JButton bolish; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JButton kopaytirish; private javax.swing.JLabel natija; private javax.swing.JTextField oyna_1; private javax.swing.JTextField oyna_2; private javax.swing.JButton qushish; private javax.swing.JButton tozalash; } Download 36.22 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling