MCPcopy Create free account
hub / github.com/Singular/Singular / filechooser

Method filechooser

Singular/LIB/surfex/ConfigFrame.java:786–862  ·  view source on GitHub ↗
(final String applicationName, String endung)

Source from the content-addressed store, hash-verified

784 }
785
786 public void filechooser(final String applicationName, String endung) {
787
788 // creating new Frame
789 final JFrame frame2 = new JFrame("load " + applicationName);
790
791 // adding container
792 Container contentPane = frame2.getContentPane();
793
794 // creating Filechooser
795 JFileChooser fileChooser = new JFileChooser(surfex_.currentDirectory);
796
797 // adding filechooser
798 contentPane.add(fileChooser, BorderLayout.CENTER);
799
800 // Create ActionListener
801 ActionListener actionListener = new ActionListener() {
802 public void actionPerformed(ActionEvent actionEvent) {
803 JFileChooser theFileChooser = (JFileChooser) actionEvent
804 .getSource();
805
806 // get command2
807 String command2 = actionEvent.getActionCommand();
808
809 // check if doubleclickt or if "open" was pressed
810 if (command2.equals(JFileChooser.APPROVE_SELECTION)) {
811 File selectedFile = theFileChooser.getSelectedFile();
812
813 // making savepopup invisible/removing it
814 frame2.dispose();
815
816 // creating complete filepath
817 String filelocation = new String(selectedFile.getParent()
818 + File.separator + selectedFile.getName());
819
820 // ausgabe fehler bein z.B.: d:\ -> d:\\ bzw \ -> \\
821 // System.out.println("filelocation : "+ filelocation + "\n");
822
823 if (applicationName == "POV") {
824 povPath.setText(filelocation);
825 boolean temp = povAvailable();
826 }
827 if (applicationName == "surf") {
828 surfPath.setText(filelocation);
829 boolean temp = surfAvailable();
830 }
831 if (applicationName == "impsurf") {
832 impsurfPath.setText(filelocation);
833 boolean temp = impsurfAvailable();
834 }
835 if (applicationName == "iview") {
836 iviewPath.setText(filelocation);
837 boolean temp = iviewAvailable();
838 }
839 } else {
840 //if(command.equals(JFileChooser.CANCEL_SELECTION)){
841 frame2.setVisible(false);
842 //}
843 }

Callers 1

actionMethod · 0.95

Calls 2

setVisibleMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected