-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlightDetailsDisplay.java
More file actions
46 lines (40 loc) · 1.02 KB
/
FlightDetailsDisplay.java
File metadata and controls
46 lines (40 loc) · 1.02 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
package cas;
import java.awt.*;
import javax.swing.*;
import Ertsys.*;
public class FlightDetailsDisplay extends JPanel
{
private Aircraft _aircraft;
private JLabel _labels[] = new JLabel[6];
public FlightDetailsDisplay(Aircraft aircraft)
{
_aircraft = aircraft;
setLayout(new GridLayout(3, 2));
addLabels();
setInitialLabels();
setVariableLabels();
setBorder(BorderFactory.createLineBorder(getForeground()));
}
private void setInitialLabels()
{
_labels[2].setText(" Position: ");
_labels[4].setText(" Velocity: ");
}
private void setVariableLabels()
{
if (_aircraft != null)
{
_labels[0].setText(" " + _eSystem._lJavaString(_aircraft.identification));
_labels[3].setText(_eSystem._lJavaString(_aircraft.position._rtoString()));
_labels[5].setText(_eSystem._lJavaString(_aircraft.velocity._rtoString()));
}
}
private void addLabels()
{
for (int i = 0; i < _labels.length; i++)
{
if (_labels[i] == null) { _labels[i] = new JLabel(" "); }
this.add(_labels[i]);
}
}
}