()
| 618 | } |
| 619 | |
| 620 | public void ask4surf2() { |
| 621 | int optReturn = JOptionPane.showConfirmDialog(new Panel(), |
| 622 | "Can't find surf - do yout know where surf is installed?", |
| 623 | "Can't find surf", JOptionPane.YES_NO_CANCEL_OPTION, |
| 624 | JOptionPane.QUESTION_MESSAGE); |
| 625 | switch (optReturn) { |
| 626 | case 0: |
| 627 | // ja, dann gib den Pfad an |
| 628 | // creating new Frame |
| 629 | final JFrame frame2 = new JFrame("load surf"); |
| 630 | |
| 631 | // adding container |
| 632 | Container contentPane = frame2.getContentPane(); |
| 633 | |
| 634 | // creating Filechooser |
| 635 | JFileChooser fileChooser = new JFileChooser( |
| 636 | surfex_.currentDirectory); |
| 637 | |
| 638 | // adding filechooser |
| 639 | contentPane.add(fileChooser, BorderLayout.CENTER); |
| 640 | |
| 641 | // Create ActionListener |
| 642 | ActionListener actionListener = new ActionListener() { |
| 643 | public void actionPerformed(ActionEvent actionEvent) { |
| 644 | JFileChooser theFileChooser = (JFileChooser) actionEvent |
| 645 | .getSource(); |
| 646 | |
| 647 | // get command2 |
| 648 | String command2 = actionEvent.getActionCommand(); |
| 649 | |
| 650 | // check if doubleclickt or if "open" was pressed |
| 651 | if (command2.equals(JFileChooser.APPROVE_SELECTION)) { |
| 652 | File selectedFile = theFileChooser.getSelectedFile(); |
| 653 | |
| 654 | // making savepopup invisible/removing it |
| 655 | frame2.dispose(); |
| 656 | |
| 657 | // creating complete filepath |
| 658 | String filelocation = new String(selectedFile |
| 659 | .getParent() |
| 660 | + File.separator + selectedFile.getName()); |
| 661 | |
| 662 | // ausgabe fehler bein z.B.: d:\ -> d:\\ bzw \ -> \\ |
| 663 | // System.out.println("filelocation : "+ filelocation + "\n"); |
| 664 | |
| 665 | surfPath.setText(filelocation); |
| 666 | |
| 667 | } else { |
| 668 | //if(command.equals(JFileChooser.CANCEL_SELECTION)){ |
| 669 | frame2.setVisible(false); |
| 670 | //} |
| 671 | } |
| 672 | if (surf.isSelected() && !surfAvailable()) { |
| 673 | // der Pfad war wohl nich korrekt |
| 674 | askForPOV(); |
| 675 | } |
| 676 | } |
| 677 | }; |
no test coverage detected