/* * 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 java.util.Locale; import javax.swing.JFileChooser; import view.MainWindow; /** * * @author PC */ public class OpenController implements ActionListener{ private MainWindow mainwindow; public OpenController(MainWindow mainwindow) { this.mainwindow = mainwindow; registerEvents(); } public void registerEvents() { mainwindow.getJbOpen().addActionListener(this); mainwindow.getFileOpen().addActionListener(this); } @Override public void actionPerformed(ActionEvent ae) { int wahl = mainwindow.getjFileChooser().showOpenDialog(mainwindow); if(wahl == JFileChooser.APPROVE_OPTION) { File file = mainwindow.getjFileChooser().getSelectedFile(); mainwindow.getStatusbar().setText(file.getAbsolutePath()); } } }