0

I have a submit button in java. I want after clicking on the button it will after taking user data show a message then collapse the ui pane

submitButton = new JButton("Submit");
        submitButton.setBounds(100, 270, 80, 25);
        submitButton.addActionListener(e -> {
            String Firstname = firstname.getText();
            String Lastname = lastname.getText();
            String Disability = disability.getText();
            String email = Email.getText();
            String Phonenumber = phonenumber.getText();
            String Username = userName.getText();
            String Password = passwordField.getText();
            insertUserData(Firstname,Lastname, Disability, email, Phonenumber, Username, Password );
        });
        panel.add(submitButton);

        add(panel);
        setVisible(true);
M. Deinum
  • 115,695
  • 22
  • 220
  • 224
  • 1
    what's the problem, exactly? let the handler show a optionPane after successful insert would an obvious option ... aside: hard-coded sizing and locating is __wrong__, that's the exclusive task of the layoutManager! and stick to java naming conventions please – kleopatra Apr 19 '23 at 08:40
  • As @kleopatra said, show a `JOptionPane`. Use a main `JPanel` with a `CardLayout` to switch from a registration `JPanel` to an application `JPanel`. Oracle has a helpful tutorial, [Creating a GUI With Swing](https://docs.oracle.com/javase/tutorial/uiswing/index.html). Skip the Learning Swing with the NetBeans IDE section. – Gilbert Le Blanc Apr 19 '23 at 15:54

0 Answers0