-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlightsDetailsDisplay.java
More file actions
48 lines (42 loc) · 995 Bytes
/
FlightsDetailsDisplay.java
File metadata and controls
48 lines (42 loc) · 995 Bytes
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
package cas;
import java.awt.*;
import javax.swing.*;
import java.util.List;
import java.util.ArrayList;
import Ertsys.*;
public class FlightsDetailsDisplay extends JPanel
{
private List<FlightDetailsDisplay> _flightsDisplay = new ArrayList<FlightDetailsDisplay>();
public FlightsDetailsDisplay(List<Aircraft> aircrafts)
{
setLayout(new GridLayout(0, 1));
addDisplays(aircrafts);
}
public void update(List<Aircraft> aircrafts)
{
removeDisplays();
addDisplays(aircrafts);
}
private void removeDisplays()
{
for (int i = 0; i < _flightsDisplay.size(); i++)
{
this.remove(_flightsDisplay.get(i));
}
_flightsDisplay.clear();
}
private void addDisplays(List<Aircraft> aircrafts)
{
if (aircrafts != null)
{
int i;
for (i = 0; i < aircrafts.size(); i++)
{
FlightDetailsDisplay fdd = new FlightDetailsDisplay(aircrafts.get(i));
fdd.setMinimumSize(new Dimension(350, 30));
_flightsDisplay.add(fdd);
this.add(fdd);
}
}
}
}