Menu

[r51]: / GraphScript / trunk / ls / graph / ui / StatusPanel.java  Maximize  Restore  History

Download this file

74 lines (63 with data), 1.8 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package ls.graph.ui;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JPanel;
import ls.graph.script.Algorithm;
import ls.graph.script.AlgorithmListener;
public class StatusPanel extends JPanel implements AlgorithmListener
{
private static final long serialVersionUID = 1L;
private JLabel lblStatus = null;
private JLabel lblStep = null;
private JLabel lblStepCount = null;
private int stepCount = 0;
StatusPanel()
{
super();
initComponents();
}
private void initComponents()
{
FlowLayout l = new FlowLayout();
l.setAlignment(FlowLayout.TRAILING);
this.setLayout(l);
Font captionFont = new Font("Arial",Font.BOLD,11);
Font dataFont = new Font("Arial",Font.PLAIN,11);
JLabel lbl = new JLabel("Status:"); lbl.setFont(captionFont);
this.add(lbl);
lblStatus = new JLabel();
lblStatus.setFont(dataFont);
this.add(lblStatus);
lbl = new JLabel("Step:"); lbl.setFont(captionFont);
this.add(lbl);
lblStep = new JLabel();
lblStep.setFont(dataFont);
this.add(lblStep);
lbl = new JLabel("Step Count: "); lbl.setFont(captionFont);
this.add(lbl);
lblStepCount = new JLabel();
lblStepCount.setFont(dataFont);
this.add(lblStepCount);
}
public void executionEnded(Algorithm alg)
{
lblStatus.setText("Stopped");
// lblStep.setText("-");
// lblStepCount.setText("-");
this.stepCount = 0;
}
public void executionStarted(Algorithm alg)
{
lblStatus.setText("Running");
lblStep.setText("0");
this.stepCount = 0;
lblStepCount.setText(String.valueOf(this.stepCount));
}
public void startingStep(int stepIndex)
{
lblStep.setText(String.valueOf(stepIndex));
this.stepCount++;
lblStepCount.setText(String.valueOf(this.stepCount));
}
}
MongoDB Logo MongoDB