-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathSubsetFileChooser.java
More file actions
50 lines (40 loc) · 1.17 KB
/
SubsetFileChooser.java
File metadata and controls
50 lines (40 loc) · 1.17 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
import java.awt.GridLayout;
import java.text.NumberFormat;
import javax.swing.JFileChooser;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* SubsetFileChooser - Standard JFileChooser with added text boxes for start and length
*
* @author Dakota Williams
*/
public class SubsetFileChooser extends JFileChooser {
private JFormattedTextField startText
= new JFormattedTextField(NumberFormat.getIntegerInstance());
private JFormattedTextField lenText
= new JFormattedTextField(NumberFormat.getIntegerInstance());
/**
* Constructor - adds special components
*/
public SubsetFileChooser() {
super();
startText.setValue(0L);
startText.setColumns(10);
lenText.setValue(0L);
lenText.setColumns(10);
JPanel accessPanel = new JPanel();
accessPanel.setLayout(new GridLayout(4, 1));
accessPanel.add(new JLabel("Start offset (ms):"));
accessPanel.add(startText);
accessPanel.add(new JLabel("Length (ms):"));
accessPanel.add(lenText);
this.setAccessory(accessPanel);
}
public long getStartTime() {
return (Long)startText.getValue();
}
public long getLengthTime() {
return (Long)lenText.getValue();
}
}