Une méthode crée un objet nommé suivant un paramètre (String)
Salut !
J'ignore comment créer un objet dans une fonction, dont le nom sera donné par paramètre.
Vous comprendrez ce que je cherche à faire avec cet exemple :
Code:
1 2 3 4 5 6 7 8
|
void createTimerpanel(String timerpanelName, String label, int timeTotal, boolean isCustom){
Timerpanel timerpanelName = new Timerpanel(label, timeTotal, isCustom);
jPanelMain.add(timerpanelName);
timerpanelName.setVisible(false);
} |
Voilà c'est faux bien sûr, mais intuitivement j'ai essayé ça à tout hasard...
Conseils appréciés ! Merci !