为什么 public static void main(String args[]) 错误并且它说表达式的非法开始?

why the public static void main(String args[]) error and it say illegal start of expression?

我是 netbeans 的新手,正在做功课 我正在尝试连接到 derby 数据库,但是 public static void 显示错误我不知道该怎么做这是我的代码: 导入 java.sql.; 导入 javax.swing.;

public class addcriminal 扩展 javax.swing.JFrame {

public addcriminal() {
    initComponents();
}

@SuppressWarnings("unchecked")

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    try{
        String url="jdbc:derby://localhost:1527/criminal records ";
        String username ="naim";
        String password = "12345";

        Connection con = DriverManager.getConnection(url,username,password);
        Statement stmt = con.createStatement ();
        String Query;
        Query = "INSERT INTO CRIMINAL RECORDS (ID, NAME, AGE, ICNO, SEX, CRIME, PERIODS)VALUES ('"+txtno.getText()+"' , '"+txtname.getText()+"', '"+txtage.getText()+"', '"+txtic.getText()+"','"+txtic.getText()+"', '"+combosex.getSelectedItem()+"', '"+txtcrime.getText()+"', '"+txtperiods.getText()+"')";
        stmt.execute(Query);
        JOptionPane.showMessageDialog(null, "criminal recorded");
        txtno.setText(null);
        txtname.setText(null);

        txtage.setText(null);
        txtic.setText(null);
        combosex.setSelectedItem(null);
        txtcrime.setText(null);
        txtperiods.setText(null);
    }
     catch(SQLException ex) {
        JOptionPane.showMessageDialog(null, ex.toString());

}                                        

public static void main(String args[]) { <<ERROR HERE

    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new addcriminal().setVisible(true);
        }
    });
}

在我看来,您似乎忘记了 catch 语句中的右大括号。

catch(SQLException ex) {
    JOptionPane.showMessageDialog(null, ex.toString()); 
}