I am learning graphical interface in java with JFrame and I want to pass an object of a frame which creates a series to the main frame where I can see different objects.
I thought about using a getter so that the return is of the Series type, but when applying the method in the "parent" or main frame, I do not comply with the parameters of the method that is just having a object.
I also thought about using a setter but I see it as useless because I do not want to assign a value, but rather use the one that already believes in the other frame.
Finally it occurred to me to have an object already created in the main frame and recast it in my main frame but I think that would leave me 2 equal objects and a huge loss of efficiency and resources. p>
** I update the question to show you part of the code:
The Main Frame with the jButton create Series
private void Create_series_butomActionPerformed (java.awt.event.ActionEvent evt) {
Creacion_de_Serie serie_creada=new Creacion_de_Serie();
serie_creada.setVisible(true);
// Creacion_de_Serie.Llevar_Serie(objeto);
// El metodo llevar serie me trae el objeto de la otra interfaz
El frame secundario (clase Serie_Creada)
private void butom_aceptarActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String nom, create, gene;
int tem;
crea=this.txt_Creador.getText();
nom=this.txt_Nombre.getText();
tem=Integer.parseInt(this.txt_numero_tempo.getText());
gen=this.txt_Genero.getText();
Serie sere1=new Serie(nom, tem,false,gen, crea);
Llevar_Serie(sere1);
JOptionPane.showMessageDialog(null, "La Serie fue agregada" );
this.setVisible(false);
Thanks, again !!