David Martínez wrote:I can't edit my previous post . . .
Unfortunately, I can make you edit the previous post. Sorry about this, but the lines were so long I am going to have to ask you to change them. There are more details in the old Sun style guide and our Ranch FAQ. Sorry about that.
Your RegistroEstudiante.inicio() method creates a new Correos instaqnce named "Correos".
First, it is a bad idea to have an instance variable whose name begins with a capital letter, especially if that makes the instance variable name identical to the name of the class.
Second, why are you creating a new Correos there? Your RegistroEstudiante instance is already a Correos.
So now you have two Correos instances, each with its own separate correoConcatenado variable.
Your actionPerformed() method is setting one of those, and your Correos.getCorreoConcatenado() method is returning the value of the other one, which has never been reset.
Rob Camick wrote:You can add any component to a JOptionPane.
So yes you can add a JPanel containing those two components.
JOptionPane's message parameter is declared to be of type Object. So, yes, you can pass a JPanel and it will work, but you don't actually need to use a JPanel.
You can pass a simple array for the message (for example, an array of length 5 that contains a String, a JTextField, another String, a JComboBox, and one more String). This is described in the JavaDocs for JOptionPane, not in the method descriptions but in the text at the top of the javadoc page.