Afficher une popup lors du clic sur un élément du menu

Résolu
cs_thespartan Messages postés 36 Date d'inscription samedi 3 février 2007 Statut Membre Dernière intervention 26 mai 2008 - 24 déc. 2007 à 07:47
cs_thespartan Messages postés 36 Date d'inscription samedi 3 février 2007 Statut Membre Dernière intervention 26 mai 2008 - 24 déc. 2007 à 10:04
Je cherche à  afficher un JDialog :

if ("machin".equals(e.getActionCommand())) {
            JPanel panel = new JPanel(false);
            JDialog d = new JDialog(getFrame(), "damn it");

            JTextField message = new JTextField("écrire ici");
            panel.add(message);
            d.add(panel);
            d.pack();

            System.out.println("modifier @");
        }

avec

public Frame getFrame() {
        Component component = this;
        do {
            component = component.getParent();
        } while (!(component instanceof Frame));
        return (Frame) component;
    }

L'évènement est "machin", l'évènement est bien reconnu puisque le print est effecté mais aucune popup ne s'ouvre.

Spartan

1 réponse

cs_thespartan Messages postés 36 Date d'inscription samedi 3 février 2007 Statut Membre Dernière intervention 26 mai 2008
24 déc. 2007 à 10:04
j'avais oublié de mettre un d.setVisible(true); pour l'afficher

Spartan
3
Rejoignez-nous