Comment un JDialog peut me retourner une valeur ?
Salut.
J'ai une fiche de type JFrame et une class qui etand la classe JDialog(DialogPerso). Je veux afficher la class DialogPerso et puis recuperer les valeurs entrees dans cette boite de dialogue. Je sais pas si c'est claire mais voila je vous monter le code qui marche pas comme je veux :roll:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
package dev;
import javax.swing.JFrame;
public class MainFiche {
public static void main(String[] args) {
JFrame frame = new JFrame("MainFicher");
String init = "info initiale ";
DialogPerso dialogPerso = new DialogPerso(frame,true,init);
dialogPerso.setVisible(true);
// Ca doit afficher "info initiale Info de JDialog ajoute" mais ....
// Ca donne seulement "info initiale " ?!
System.out.println(init);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,300);
frame.setVisible(true);
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
package dev;
import java.awt.Frame;
import javax.swing.JDialog;
public class DialogPerso extends JDialog {
private static final long serialVersionUID = 1L;
private String information = "";
public DialogPerso(Frame f, boolean modal,String information) {
super(f, modal);
this.information = information;
this.information += "Info de JDialog ajoute";
}
} |
Merci