I'm trying to make a calculator program, and I want to only allow numbers to be typed, but I don't know how to do that, will you please tell me how. I haven't found anything elsewhere. Here is my source code:
import javax.swing.*;
import java.awt.*;
public class Sect1 extends JTextArea{
public static final Dimension ss = Toolkit.getDefaultToolkit().getScreenSize();
public Sect1(){
this.setBounds(ss.width / 4, ss.height / 5, 100, 100);
this.setLineWrap(true);
this.setWrapStyleWord(true);
}
}