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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
package bjc.imgchain.pipeline.stages;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import bjc.imgchain.utils.ImmutableTableModel;
/**
* Stage picker GUI.
*
* @author Ben Culkin
*
*/
public class StagePicker extends JDialog {
private static final long serialVersionUID = 1L;
/**
* Stage name to pick.
*/
public String stageName;
/**
* Create a new stage picker.
*/
public StagePicker() {
super();
setModalityType(ModalityType.APPLICATION_MODAL);
setTitle("Add a Stage");
setupGUI();
}
private void setupGUI() {
setLayout(new BorderLayout());
String[] columnNames = new String[] { "Stage Name", "Stage Description" };
/*
* :AddStage
*/
String[][] data = new String[][] { { "Identity", "Pass through image unchanged" },
{ "Greyscale", "Convert a color image into greyscale" },
{ "Color Skew", "Adjust color balance" }, { "Sepia", "Make your image sepia toned" },
{ "Negative", "Invert your images colors" }, { "Gaussian Blur", "Blur images" },
{ "Tint", "Add/remove colors" },
{ "Colorized Threshold", "Convert the image to three-tone" },
{ "Sub-pipeline", "Execute another pipeline" },
{ "Load Image", "Load an image from a file" },
{ "Save Image", "Save an image to a file" },
{ "Stash Image", "Stash an image to memory" },
{ "Recall Image", "Recall an image from memory" },
{ "Additive Mask", "Add two images together" },
{ "Subtractive Mask", "Subtract one image from another" } };
JTable stageTable = new JTable(new ImmutableTableModel(data, columnNames));
JScrollPane tableScroll = new JScrollPane(stageTable);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(2, 1));
JButton addStage = new JButton("Add Stage");
addStage.addActionListener((ev) -> {
stageName = (String) stageTable.getModel().getValueAt(stageTable.getSelectedRow(), 0);
setVisible(false);
dispose();
});
JButton cancel = new JButton("Cancel");
cancel.addActionListener((ev) -> {
setVisible(false);
dispose();
});
buttonPanel.add(addStage);
buttonPanel.add(cancel);
add(tableScroll, BorderLayout.CENTER);
add(buttonPanel, BorderLayout.PAGE_END);
}
}
|