blob: 3539beb5e60c8cbd2a907395ff851b2895c5b6f3 (
plain)
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
|
package bjc.imgchain.pipeline;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import bjc.imgchain.ImgChain;
public class PipelinePicker extends JDialog {
private static final long serialVersionUID = 1L;
public String pipeName;
public PipelinePicker() {
super();
setModalityType(ModalityType.APPLICATION_MODAL);
setTitle("Apply a Pipeline");
setupGUI();
}
private void setupGUI() {
setLayout(new BorderLayout());
DefaultListModel<String> pipeModel = new DefaultListModel<>();
for (String pipeName : ImgChain.chan.pipelineRepo.keySet()) {
pipeModel.addElement(pipeName);
}
JList<String> pipeList = new JList<>(pipeModel);
JScrollPane listScroll = new JScrollPane(pipeList);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(2, 1));
JButton addStage = new JButton("Apply Pipe");
addStage.addActionListener((ev) -> {
pipeName = pipeList.getSelectedValue();
setVisible(false);
dispose();
});
JButton cancel = new JButton("Cancel");
cancel.addActionListener((ev) -> {
setVisible(false);
dispose();
});
buttonPanel.add(addStage);
buttonPanel.add(cancel);
add(listScroll, BorderLayout.CENTER);
add(buttonPanel, BorderLayout.PAGE_END);
}
}
|