You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ControllerOeffnen.java 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package controller;
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9. import java.io.File;
  10. import javax.swing.JFileChooser;
  11. import prfourgui.View.AdressbuchView;
  12. /**
  13. *
  14. * @author baumannan68085
  15. */
  16. public class ControllerOeffnen implements ActionListener
  17. {
  18. private AdressbuchView view;
  19. public ControllerOeffnen(AdressbuchView view)
  20. {
  21. this.view = view;
  22. }
  23. public void registerEvents(){
  24. view.getMnuOpen().addActionListener(this);
  25. }
  26. @Override
  27. public void actionPerformed(ActionEvent ae)
  28. {
  29. JFileChooser fc = view.getjFileChooser1();
  30. int wahl = fc.showOpenDialog(view);
  31. if(wahl == JFileChooser.APPROVE_OPTION){
  32. File datei = fc.getSelectedFile();
  33. String dateiname = datei.getAbsolutePath();
  34. view.getTxtStatus().setText("Dateipfad:" + dateiname);
  35. }
  36. }
  37. }