ap.setPreferredSize(new Dimension(60, 60));
titlePanel.add(ap, BorderLayout.WEST);
titlePanel.add(titleText, BorderLayout.CENTER);
+ setStatus(currentStatus);
Thread thread = new Thread(ap);
thread.start();
BufferedImage offscreen;
@Override
- public void run()
+ public void run()
{
startTime = System.currentTimeMillis();
+ float invSpeed = 30f;
while (currentStatus < STATE_STOPPED_OK)
{
+ if (currentStatus == STATE_QUEUING)
+ {
+ invSpeed = 25f;
+ }
+ else if (currentStatus == STATE_RUNNING)
+ {
+ invSpeed = 10f;
+ }
try
{
Thread.sleep(50);
int units = (int) ((System.currentTimeMillis() - startTime)
- / 10f);
+ / invSpeed);
angle += units;
angle %= 360;
startTime = System.currentTimeMillis();
if (currentStatus >= STATE_STOPPED_OK)
{
+ park();
angle = 0;
}
cancel.setEnabled(false);
}
+ public void park()
+ {
+ startTime = System.currentTimeMillis();
+
+ while (angle < 360)
+ {
+ try
+ {
+ Thread.sleep(25);
+
+ int units = (int) ((System.currentTimeMillis() - startTime)
+ / 5f);
+ angle += units;
+ startTime = System.currentTimeMillis();
+
+ if (angle >= 360)
+ {
+ angle = 360;
+ }
+
+ repaint();
+ } catch (Exception ex)
+ {
+ }
+ }
+
+ }
+
void drawPanel()
{
if (offscreen == null || offscreen.getWidth(this) != getWidth()