How can I activition ok Button in this code?

Dalia_

Prominent
Mar 30, 2017
2
0
510
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
public class Create extends JFrame implements ActionListener {
String msg="";
JButton btnOk,btnExit;
JLabel lblName,lblId,lblMid,lblFinal,lbltotal,lblGrade;
JTextField txtName,txtId,txtMid,txtGrade,txtFinal,txtTotal;


public Create()
{
super("Create");
setLayout(null);

lblName = new JLabel("Name: ");
lblName.setBounds(20,60,100,20);
add(lblName);
lblId = new JLabel("Id: ");
lblId.setBounds(20,20,100,20);
add(lblId);

lblMid = new JLabel("Mid: ");
lblMid.setBounds(20,100,100,20);
add(lblMid);

lblFinal = new JLabel("final : ");
lblFinal.setBounds(20,140,100,20);
add(lblFinal);
lbltotal = new JLabel("Total: ");
lbltotal.setBounds(20,180,100,20);
add(lbltotal);
lblGrade = new JLabel("Grade: ");
lblGrade.setBounds(20,210,100,20);
add(lblGrade);
txtName = new JTextField();
txtName.setBounds(140,60,100,20);
add(txtName);
txtId = new JTextField();
txtId.setBounds(140,20,100,20);
add(txtId);
txtMid = new JTextField();
txtMid.setBounds(140,100,100,20);
add(txtMid);
txtFinal = new JTextField();
txtFinal.setBounds(140,140,100,20);
add(txtFinal);

txtTotal = new JTextField();
txtTotal.setBounds(140,180,100,20);
add(txtTotal);

txtGrade = new JTextField();
txtGrade.setBounds(140,210,100,20);
add(txtGrade);
txtGrade.setEditable(false);
txtTotal.setEditable(false);

btnOk = new JButton("OK");
btnOk.setBounds(20,250,100,35);
add(btnOk);
btnOk.addActionListener(this);
btnExit = new JButton("EXIT");
btnExit.setBounds(140,250,100,35);
add(btnExit);
btnExit.addActionListener(this);
setSize(280,380);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public void actionPerformed ( ActionEvent e){
if (e.getSource() == btnOk){


}
else if (e.getSource() ==btnExit ){

}
}
public static void main (String[] args) {
new Create();
}

}
 

Dalia_

Prominent
Mar 30, 2017
2
0
510


@rgd1101 There is no result I need to put commands into action listener but I don't know how I can write the coomands?