()
| 710 | } |
| 711 | |
| 712 | private void save_as_and_close_Project() { |
| 713 | String internalname = projectName; // interneer name des aktuell foku |
| 714 | // creating new Frame |
| 715 | final JFrame frame2 = new JFrame("save" + internalname + " as"); |
| 716 | |
| 717 | // adding container |
| 718 | Container contentPane = frame2.getContentPane(); |
| 719 | |
| 720 | // creating Filechooser |
| 721 | JFileChooser fileChooser = new JFileChooser(surfex_.currentDirectory); |
| 722 | |
| 723 | // adding filechooser |
| 724 | contentPane.add(fileChooser, BorderLayout.CENTER); |
| 725 | |
| 726 | // Create ActionListener |
| 727 | ActionListener actionListener = new ActionListener() { |
| 728 | public void actionPerformed(ActionEvent actionEvent) { |
| 729 | JFileChooser theFileChooser = (JFileChooser) actionEvent.getSource(); |
| 730 | |
| 731 | // get command |
| 732 | String command = actionEvent.getActionCommand(); |
| 733 | |
| 734 | // check if doubleclickt or if "open" was pressed |
| 735 | if (command.equals(JFileChooser.APPROVE_SELECTION)) { |
| 736 | |
| 737 | File selectedFile = theFileChooser.getSelectedFile(); |
| 738 | |
| 739 | // making savepopup invisible/removing it |
| 740 | frame2.dispose(); |
| 741 | |
| 742 | // creating complete filepath |
| 743 | String filelocation = new String(selectedFile.getParent() |
| 744 | + "\\" + selectedFile.getName()); |
| 745 | |
| 746 | // ausgabe fehler bein z.B.: d:\ -> d:\\ bzw \ -> \\ |
| 747 | // System.out.println("filelocation : " + filelocation + "\n"); |
| 748 | save(filelocation); |
| 749 | // this is not the cancel-button |
| 750 | // } else if (command.equals(JFileChooser.CANCEL_SELECTION)) |
| 751 | // { |
| 752 | } |
| 753 | closeProject(); |
| 754 | } |
| 755 | }; |
| 756 | |
| 757 | // Adding filefilters |
| 758 | // how to get "all common files"&"common image files" in current |
| 759 | // language? |
| 760 | // no global array! -> you have to carry the readmenuentries[] with you |
| 761 | // through |
| 762 | // all maethods as argument @aufruf (?selection?) |
| 763 | FileFilter acfFilter = new ExtensionFileFilter("all common files", |
| 764 | new String[] { "JPG", "JPEG", "jpg", "jpeg", |
| 765 | //"gif", "tif", |
| 766 | //"spc", |
| 767 | // "sun" |
| 768 | }); |
| 769 | fileChooser.addChoosableFileFilter(acfFilter); |
no test coverage detected