-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestJFilePicker.java
More file actions
56 lines (42 loc) · 1.42 KB
/
TestJFilePicker.java
File metadata and controls
56 lines (42 loc) · 1.42 KB
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
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.io.File;
import java.io.IOException;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class TestJFilePicker extends JFrame {
public TestJFilePicker() throws IOException {
super("Vormetric Application Encryption (VAE) Encrypt/Decrypt REST Example");
//setLayout(new FlowLayout());
setLayout(new GridLayout(2,3));
// set up a file picker component
JFilePicker filePicker = new JFilePicker("Pick a file to Encrypt/Decrypt", "Browse...");
filePicker.setMode(JFilePicker.MODE_SAVE);
filePicker.addFileTypeFilter(".txt", "Text Files");
// filePicker.addFileTypeFilter(".csv", "CSV Files");
filePicker.addFileTypeFilter("enc", "Encrypted Files");
// access JFileChooser class directly
JFileChooser fileChooser = filePicker.getFileChooser();
fileChooser.setCurrentDirectory(new File("."));
// add the component to the frame
add(filePicker);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//setSize(640, 100);
setSize(720, 140);
//setLocationRelativeTo(null); // center on screen
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
new TestJFilePicker().setVisible(true);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
}