(String command)
| 913 | } |
| 914 | |
| 915 | public void actionCommand(String command) { |
| 916 | |
| 917 | if (command == "save") { |
| 918 | if (filename == null) { |
| 919 | command = "saveas"; |
| 920 | } else { |
| 921 | save(filename); |
| 922 | } |
| 923 | } |
| 924 | |
| 925 | if (command == "saveas") { |
| 926 | // creating new Frame |
| 927 | final JFrame frame2 = new JFrame("save " + projectName + " as"); |
| 928 | |
| 929 | // adding container |
| 930 | Container contentPane = frame2.getContentPane(); |
| 931 | |
| 932 | if (surfex_.inAnApplet) { |
| 933 | ActionListener aL = new ActionListener() { |
| 934 | public void actionPerformed(ActionEvent actionEvent) { |
| 935 | String command2 = actionEvent.getActionCommand(); |
| 936 | //System.out.println("com:"+command2); |
| 937 | // check if doubleclickt or if "open" was pressed |
| 938 | if (command2.equals(" save ")) { |
| 939 | // creating complete filepath |
| 940 | String filelocation = tf.getText(); |
| 941 | //System.out.println("file:"+filelocation); |
| 942 | // ausgabe fehler bein z.B.: d:\ -> d:\\ bzw \ -> \\ |
| 943 | // System.out.println("filelocation : "+ |
| 944 | // filelocation + "\n"); |
| 945 | save(filelocation); |
| 946 | |
| 947 | frame2.dispose(); |
| 948 | } else { |
| 949 | //if(command.equals(JFileChooser.CANCEL_SELECTION)){ |
| 950 | frame2.dispose(); |
| 951 | //} |
| 952 | } |
| 953 | } |
| 954 | }; |
| 955 | contentPane.setLayout(new BorderLayout()); |
| 956 | contentPane.add(new JLabel("Give filename: "), |
| 957 | BorderLayout.WEST); |
| 958 | tf = new JTextField("test.sux"); |
| 959 | contentPane.add(tf, BorderLayout.CENTER); |
| 960 | JPanel tmpPanel = new JPanel(); |
| 961 | tmpPanel.setLayout(new FlowLayout()); |
| 962 | //String strFormats[] = { "sux" }; |
| 963 | JButton jbsave = new JButton(" save "); |
| 964 | jbsave.addActionListener(aL); |
| 965 | tmpPanel.add(jbsave); |
| 966 | JButton jbcancel = new JButton(" cancel "); |
| 967 | jbcancel.addActionListener(aL); |
| 968 | tmpPanel.add(jbcancel); |
| 969 | contentPane.add(tmpPanel, BorderLayout.EAST); |
| 970 | frame2.setSize(500, 75); |
| 971 | } else { |
| 972 | // creating Filechooser |
no test coverage detected