-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDecompressPanel.java
More file actions
51 lines (39 loc) · 1.51 KB
/
DecompressPanel.java
File metadata and controls
51 lines (39 loc) · 1.51 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
public class DecompressPanel extends JPanel {
private JButton loadBtn, decompressBtn;
private LabelText filePath;
private String compressedPath;
DecompressPanel()
{
setLayout(new FlowLayout());
loadBtn = new JButton("Load");
add(loadBtn);
filePath = new LabelText("File Path: ", 30);
add(filePath);
decompressBtn = new JButton("Decompress");
add(decompressBtn);
loadBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser("C:\\Users\\MostafaOmar\\IdeaProjects\\vector-quantizer");
int status = fc.showOpenDialog(fc.getParent());
if (status == 0)
compressedPath = new String(fc.getSelectedFile().getPath());
else
compressedPath = new String();
filePath.setText(compressedPath);
System.out.println(filePath.getText());
}
});
decompressBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
VectorQuantizerController.decompress(compressedPath, "D:\\mtest\\decompressed.jpg");
}
});
}
}