Can you have several different JFrames and save them in a single hashmap? Then get your own methods and attributes?

0

This is my idea. I have two JFrame form_guardarDatos and form_mostrarDatos . I want to save them in a hashMap and then use that hashMap to invoke them in a main class. For example to obtain the data to be saved by invoking

mapa['keyGuardarDatos'].getDatoAGuardar().getText();  

In this case getDatoAGuardar() is only in form_guardarDatos .

If I'm not wrong in python I could pass a class as an instance and always get its attributes and methods within a list but I do not know if this is possible in java since to pass a parameter it is necessary to declare the type equal to its class .

Greetings and thanks for the support.

    
asked by Angel 29.04.2017 в 17:38
source

1 answer

0

Can not. I solved the problem by working something similar to the controller view model. Create a driver class where you start the jframe and pass that same class to the constructor and within the frames I send the functions I need.

    
answered by 01.05.2017 / 23:57
source