-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCloudCoverLimit.java
executable file
·60 lines (53 loc) · 2.08 KB
/
CloudCoverLimit.java
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
// CloudCoverLimit.java implements panel to allow setting the maximum cloud
// cover the user wants to see.
//-------------------------------------------------------------------------
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class CloudCoverLimit extends JPanel implements ActionListener
{
private CloudCoverChoice ccPercent; // maximum cloud cover selection widget
private MosaicData md; // mosaic data object
// Constructor for the CloudCoverLimit widget
//-------------------------------------------
CloudCoverLimit(imgViewer parent, MosaicData mdIn)
{
md = mdIn;
// do not use a layout manager since none of them seem to do well
// with choice widgets on all platforms
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
// create the label and add it to the panel
JLabel label = new JLabel("Max Cloud:");
label.setFont(parent.boldFont);
label.setDisplayedMnemonic('x');
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 10;
gbc.weighty = 0;
gbc.gridheight = 1;
add(label,gbc);
// create a percent dropdown list
ccPercent = new CloudCoverChoice();
ccPercent.setFont(parent.normalFont);
ccPercent.setToolTipText("Set cloud limit");
ccPercent.addActionListener(this);
label.setLabelFor(ccPercent);
add(ccPercent,gbc);
}
// method to detect when the cloud cover limit is changed
//-------------------------------------------------------
public void actionPerformed(ActionEvent e)
{
md.setCCLimit(ccPercent.getCloudCover());
}
// method to allow setting the cloud cover limit when it is changed
// by another mechanism
//-----------------------------------------------------------------
public void setCloudCover(int cc)
{
ccPercent.setCloudCover(cc);
}
}