NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import java.awt.*;
import java.awt.event.*;



public class Hesapmakinesi extends Frame {

private Label lbl;
private TextField tf;
private Label lbl1;
private TextField tf1;
private Label lbl2;
private TextField tf2;
private Button btntop;
private Button btncık;
private Button btnbol;
private Button btncarp;
private Button btnclear;
private int sonuc = 0;

public Hesapmakinesi() {

setLayout(new GridLayout(6, 2, 5, 5));

lbl = new Label("1. Sayı");
add(lbl);

tf = new TextField(5);
add(tf);

lbl1 = new Label("2. Sayı");
add(lbl1);

tf1 = new TextField(5);
add(tf1);

lbl2 = new Label("Results");
add(lbl2);

tf2 = new TextField(sonuc + "", 5);
tf2.setEditable(false);
add(tf2);

btntop = new Button("+");
add(btntop);
btntop listener = new btntop();
btntop.addActionListener(listener);

btncık = new Button("-");
add(btncık);
btncık listener1 = new btncık();
btncık.addActionListener(listener1);

btnbol = new Button("/");
add(btnbol);
btnbol listener2 = new btnbol();
btnbol.addActionListener(listener2);

btncarp = new Button("*");
add(btncarp);
btncarp listener3 = new btncarp();
btncarp.addActionListener(listener3);

btnclear = new Button("Clear");
add(btnclear);
btnclear listener4 = new btnclear();
btnclear.addActionListener(listener4);




addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});

setSize(300,300);
setVisible(true);
}
public static void main(String[] args) {

Hesapmakinesi app = new Hesapmakinesi();
}

private class btntop implements ActionListener {

@Override
public void actionPerformed(ActionEvent evt) {

String str = tf.getText().trim();
String str1 = tf1.getText().trim();


if(str.isEmpty()||str1.isEmpty()) {
System.out.println("a");
return;
}

int sayı1=Integer.parseInt(tf.getText());
int sayı2=Integer.parseInt(tf1.getText());

sonuc=sayı1+sayı2;

tf2.setText(sonuc+"");


}

}

private class btncık implements ActionListener {

@Override
public void actionPerformed(ActionEvent evt) {

String str = tf.getText().trim();
String str1 = tf1.getText().trim();


if(str.isEmpty()||str1.isEmpty()) {
System.out.println("a");
return;
}

int sayı1=Integer.parseInt(tf.getText());
int sayı2=Integer.parseInt(tf1.getText());

sonuc=sayı1-sayı2;

tf2.setText(sonuc+"");


}}

private class btnbol implements ActionListener {

@Override
public void actionPerformed(ActionEvent evt) {

String str = tf.getText().trim();
String str1 = tf1.getText().trim();


if(str.isEmpty()||str1.isEmpty()) {
System.out.println("a");
return;
}

int sayı1=Integer.parseInt(tf.getText());
int sayı2=Integer.parseInt(tf1.getText());

sonuc=sayı1/sayı2;

tf2.setText(sonuc+"");


}}
private class btncarp implements ActionListener {

@Override
public void actionPerformed(ActionEvent evt) {

String str = tf.getText().trim();
String str1 = tf1.getText().trim();


if(str.isEmpty()||str1.isEmpty()) {
System.out.println("a");
return;
}

int sayı1=Integer.parseInt(tf.getText());
int sayı2=Integer.parseInt(tf1.getText());

sonuc=sayı1*sayı2;

tf2.setText(sonuc+"");


}
}
private class btnclear implements ActionListener {

@Override
public void actionPerformed(ActionEvent evt) {

tf.setText("");
tf1.setText("");
tf2.setText("");

}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.