123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /* ALT
-
-
-
-
-
- * 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.prefs.Preferences;
- import javax.swing.JFileChooser;
- import view.gui;
-
- /**
- *
- * @author endresma66479
- *
- public class C_FileDialogOpen implements ActionListener
- {
- gui frm;
- File data;
- String PATH_ID;
- Preferences pref;
- public C_FileDialogOpen(gui g, String ID, Preferences p)
- {
- this.frm = g;
- this.data = null;
- this.PATH_ID = ID;
- this.pref = p;
- }
-
- public void registerEvents()
- {
- this.frm.getBtnOpen().addActionListener(this);
- this.frm.getMiOpen().addActionListener(this);
- this.frm.getMiOpen_popup().addActionListener(this);
- }
-
- @Override
- public void actionPerformed(ActionEvent ae)
- {
- System.out.println("opening a file...");
- System.out.println(this.pref.get(PATH_ID, "xyz"));
- JFileChooser fc = this.frm.getFileChooser();
- if(fc.showOpenDialog(frm) == JFileChooser.APPROVE_OPTION)
- {
- this.data = fc.getSelectedFile();
- this.frm.getLblFilePath().setText(this.data.getAbsolutePath());
- this.pref.put(this.PATH_ID, this.data.getAbsolutePath());
- System.out.println(this.pref.get(PATH_ID, "xyz"));
- }
- }
- }
- */
|