java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Getaction implements ActionListener{
    String am = "";
    String req ;
    String em = "";
    String oper = "";
    double x,y ,result;
    String res;
    Addcomp get = new Addcomp();
    public void actionPerformed(ActionEvent ev){
        req = ev.getActionCommand();

        if((req.equals("1")) ||(req.equals("2"))||(req.equals("3"))||(req.equals("4"))||(req.equals("5"))
            ||(req.equals("7"))||   (req.equals("8"))||( req.equals("9")) ){
                if (oper == null){

            am.concat(req)  ;
            get.werit.setText(am);
                }else if(oper != null){

                    em.concat(req);
                    get.werit.setText(em);
                }

            }else if((req.equals("+")) ||(req.equals("-"))||(req.equals("/"))||(req.equals("*"))||
                (req.equals("sin"))||   (req.equals("cos"))||(req.equals("clear"))){
                get.werit.setText("");
                oper = req;
                get.werit.setText(oper);
                get.werit.setText("");

            }else if (req.equals("=")){
                x = Double.parseDouble(am);
                if(em != null )
                y = Double.parseDouble(em);

                if(oper.equals("+")){

                result = x +y;  
                    res = Double.toString(result);
                    get.werit.setText(res);

                }else if(oper.equals("-")){

                    result = x -y;
                    res = Double.toString(result);
                    get.werit.setText(res);

                }else if(oper.equals("/")){

                    result = x /y;
                    res = Double.toString(result);
                    get.werit.setText(res);

                }else if(oper.equals("*")){

                    result = x * y;
                    res = Double.toString(result);
                    get.werit.setText(res);

                }else if(oper.equals("sin")){

                    result = Math.sin(x);
                    res = Double.toString(result);
                    get.werit.setText(res);

                }else if(oper.equals("cos")){

                    result = Math.cos(x);
                    res = Double.toString(result);
                    get.werit.setText(res);

                }else if (oper.equals("clear")){
                    get.werit.setText("");
                    am = "";
                    em = "";
                    x =0;
                    y =0;
                    oper = "";
                }



            }



    }
}


import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Addcomp extends JFrame{
    Container cont ;
    JTextField werit ;
    public Addcomp(){
        setTitle("AFB CALC");
        setSize(1000,1000);
        Getaction sent = new Getaction();
    cont = this.getContentPane();
    JPanel gt = new JPanel();
    JButton one = new JButton("1");
    JButton two = new JButton("2");
    JButton three = new JButton("3");
    JButton four = new JButton("4");
    JButton five = new JButton("5");
    JButton sex = new JButton("6");
    JButton seven = new JButton("7");
    JButton eight = new JButton("8");
    JButton nine = new JButton("9");

    werit = new JTextField();

    JButton add = new JButton("+");
    JButton sub = new JButton("-");
    JButton  div= new JButton("/");
    JButton bit= new JButton("*");
    JButton clear = new JButton("c");
    JButton Sin = new JButton("sin");
    JButton cos = new JButton("cos");
    JButton equal = new JButton("=");

    one.addActionListener(sent);
    two.addActionListener(sent);
    three.addActionListener(sent);
    four.addActionListener(sent);
    five.addActionListener(sent);
    sex.addActionListener(sent);
    seven.addActionListener(sent);
    eight.addActionListener(sent);
    nine.addActionListener(sent);
    add.addActionListener(sent);
    sub.addActionListener(sent);
    div.addActionListener(sent);
    Sin.addActionListener(sent);
    cos.addActionListener(sent);
    clear.addActionListener(sent);
    bit.addActionListener(sent);



    gt.add(one);
    gt.add(two);
    gt.add(three);
    gt.add(four);
    gt.add(five);
    gt.add(sex);
    gt.add(seven);
    gt.add(eight);
    gt.add(add);
    gt.add(sub);
    gt.add(div);
    gt.add(clear);
    gt.add(Sin);
    gt.add(cos);
    gt.add(equal);
    gt.add(werit);
    cont.add(gt);

    }
}

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Runcalc {
    public static void main (String[] args) {

            Addcomp eun  = new Addcomp();
            eun.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            eun.setVisible(true);

}
}

First off, put your code into the code brackets instead of copying and pasting the code in. Second, you haven't outlined the problem that you are having; you cannot expect someone to go through your code and find the bugs and fix them. Third, what error messages are you getting, if any?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.