/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JFileChooser; import prfourgui.View.AdressbuchView; /** * * @author baumannan68085 */ public class ControllerOeffnen implements ActionListener { private AdressbuchView view; public ControllerOeffnen(AdressbuchView view) { this.view = view; } public void registerEvents(){ view.getMnuOpen().addActionListener(this); } @Override public void actionPerformed(ActionEvent ae) { JFileChooser fc = view.getjFileChooser1(); int wahl = fc.showOpenDialog(view); if(wahl == JFileChooser.APPROVE_OPTION){ File datei = fc.getSelectedFile(); String dateiname = datei.getAbsolutePath(); view.getTxtStatus().setText("Dateipfad:" + dateiname); } } }