我正在尝试为数据库项目创建新的UI。但是,在创建新的GUI对象时,以及添加内容时,我仍然会遇到nullpointerexception。这是我的代码:
class DatabaseGUI extends JFrame implements ActionListener {
JTextField input;
JTextArea restult;
JButton loadButton;
JButton saveButton;
public static void main(String[] args){
DatabaseGUI databaseGUI = new DatabaseGUI();
databaseGUI.setVisible(true);
}
DatabaseGUI(){
this.setTitle("Emplyoee Database");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
Container content = getContentPane();
content.setLayout(new FlowLayout());
content.add(saveButton);
}