[Bonsoir j' ai deux class et ce que j' aimerai qui me recupere le chemin d'un fichier et qui l'inscrit dans le JTextField text de la class Mafenetre voila le code des 2 classes:
class Mafenetre:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
 
import javax.swing.*;
 
 
public  class Mafenetre extends JFrame  {
	public static String adresse;
 
 
	public Mafenetre(){
		super("TAPER VOTRE TEXTE");
		build();
	}
 
 
	JPanel PanelRecherche(){
		JPanel panel = new JPanel();
		panel.setLayout(new FlowLayout());
		//this.setSize(150, 150);
 
		JTextField text =new JTextField();
		//panel.add(text,BorderLayout.NORTH);
		panel.add(text);
 
		text.setSize(150,15);
		text.setText("fsdvfd"+adresse);
		text.setColumns(25);
		text.setFont(new Font("Arial", 1, 15));
		//panel.add(text);
 
		JButton btnP = new JButton(new Mondossier());
		panel.add(btnP,BorderLayout.EAST);
		//panel.add(btnP);
		btnP.setSize(35,15);
		btnP.setToolTipText("Parcourir");
		btnP.setFont(new Font("Arial", 1, 15));
 
 
		return panel;
	}
 
	private JPanel PanelIntitule(){
		JPanel panel1 = new JPanel();
		panel1.setLayout(new FlowLayout());
 
		JButton btn1 = new JButton();
		//add(btn1,BorderLayout.SOUTH);
		panel1.add(btn1);
		btn1.setSize(50,25);
		btn1.setText("BANQUE");
		btn1.setFont(new Font("Arial", 1, 35));
 
 
		JButton btn2 = new JButton();
		//add(btn2,BorderLayout.CENTER);
		panel1.add(btn2);
		btn2.setSize(50,25);
		btn2.setText("COMPTE");
		btn2.setFont(new Font("Arial", 1, 35));
 
 
		JButton btn3 = new JButton();
		//add(btn3,BorderLayout.SOUTH);
		panel1.add(btn3);
		btn3.setSize(50,25);
		btn3.setText("CLIENT");
		btn3.setFont(new Font("Arial", 1, 35));
 
		return panel1;
	}
 
	private void build(){
 
		setTitle("Banque DE KHALID");
		setSize(640,480);
		setLocationRelativeTo(null);
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setLayout(new FlowLayout());
		//this.setLayout(new FlowLayout());
 
		this.add(PanelRecherche());
		this.add(PanelIntitule());
 
	}
 
	public String getAdresse() {
 
		return adresse ;
 
 
	}
 
	public void setAdresse(String cheadresse) {
 
		cheadresse = adresse ;
			}
 
	public void affiche(String adresse){
		return  ;
			}
 
	public static void main(String[] args) {
		Mafenetre fnt = new Mafenetre();
		fnt.setVisible(true);
			}
 
}

puis ma class Mondossier
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
 
public class Mondossier extends AbstractAction {
	JTextField fenetre = new JTextField("Pas de fichier chargé! clique"); //nouveau champs de texte
 
	public static  String adresse;
 
 
	public Mondossier(){
		super("parcourir");
		//fenetre.setEditable(true);
 
	}
 
	public void actionPerformed(ActionEvent e) {
 
		Mafenetre fenetre = new Mafenetre() ;
		JFileChooser chooser = new JFileChooser();//création dun nouveau filechosser
		chooser.setApproveButtonText("Choix du fichier..."); //intitulé du bouton
		chooser.showSaveDialog (null); //affiche la boite de dialogue
		if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
	    		{
				 adresse = chooser.getSelectedFile().getAbsolutePath();
			 fenetre.setAdresse(adresse) ; //si un fichier est selectionné, récupérer le fichier puis sont path et l'afficher dans le champs de texte
 
	    		}
		fenetre.affiche(adresse);
 
		 }
 
}

Comment dois je m'y prendre pour inscrire le chemin dans JTextField qyuand je clique sur ok merci d' avance