summaryrefslogtreecommitdiffstats
path: root/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/FileChoices.java
blob: f84a505b6ee8aefd91ed6bae5391c9b41bb6df72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package WLC2OSIS.GUI ;

import WLC2OSIS.* ;
import Utilities.* ;

import java.awt.* ;
import java.util.* ;
import java.io.* ;
import java.awt.event.* ;
import javax.swing.*;
import javax.swing.event.* ;
import javax.swing.border.*;
//==============================================================================
/**
 * <b>Gets the input and output files.</b><p>
 */
//==============================================================================

public class FileChoices {

WLC2OSIS A ;

public FileChoices(WLC2OSIS A){
    this.A = A ;
    }
public String getInputFilename(String DefaultInputFilename){
    FileChooser inchooser = new FileChooser() ;
    inchooser.setSelectedFile(new File(DefaultInputFilename) ) ;
    inchooser.setDialogTitle("Give the input file") ;
    inchooser.setApproveButtonText("Set") ;
    inchooser.setSize( new Dimension( 500, 400 ) ) ;
    inchooser.setLocation(new Point(200, 200) );
    inchooser.revalidate() ;
    int returnValue = inchooser.showOpenDialog(A.OverallContainer) ;
    if(returnValue==JFileChooser.APPROVE_OPTION){
        String InputFilename = inchooser.getSelectedFile().getPath() ;
        return InputFilename ;
        }
    else{
        System.out.println("WLC2OSIS:FileChoices: Didn't choose the input file.") ;
        System.exit(0) ;
        return null ;}
    }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
public String getOutputDirectory(String DefaultOutputDirectory){
    FileChooser outchooser = new FileChooser() ; 
    outchooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) ;
    File InitialDirectory = new File(DefaultOutputDirectory ) ;
    outchooser.setSelectedFile(InitialDirectory) ;
    outchooser.setDialogTitle("Set the output directory") ;
    outchooser.setApproveButtonText("Set") ;
    outchooser.setSize( new Dimension( 500, 400 ) ) ;
    outchooser.setLocation(new Point(200, 200) );
    outchooser.revalidate() ;
    int returnValue = outchooser.showOpenDialog(A.OverallContainer) ;
    if(returnValue==JFileChooser.APPROVE_OPTION){
        String OutputDirectory = outchooser.getSelectedFile().getPath() ;
        return OutputDirectory ;
        }
    else{
        System.out.println("WLC2OSIS: Didn't choose the output directory.") ;
        System.exit(0) ;
        return null ;
        }
    }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
}
//==============================================================================
//==============================================================================