|
1 | 1 | /*
|
2 |
| - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
25 | 25 |
|
26 | 26 | package javax.swing.plaf.basic;
|
27 | 27 |
|
28 |
| -import sun.swing.SwingUtilities2; |
29 |
| -import java.awt.*; |
| 28 | +import java.awt.BasicStroke; |
| 29 | +import java.awt.Color; |
| 30 | +import java.awt.Component; |
| 31 | +import java.awt.Dimension; |
| 32 | +import java.awt.FontMetrics; |
| 33 | +import java.awt.Graphics; |
| 34 | +import java.awt.Graphics2D; |
| 35 | +import java.awt.Insets; |
| 36 | +import java.awt.Point; |
| 37 | +import java.awt.Rectangle; |
| 38 | +import java.awt.event.ActionEvent; |
| 39 | +import java.awt.event.ActionListener; |
| 40 | +import java.awt.event.HierarchyEvent; |
| 41 | +import java.awt.event.HierarchyListener; |
30 | 42 | import java.awt.geom.AffineTransform;
|
31 |
| -import java.awt.event.*; |
32 |
| -import javax.swing.*; |
33 |
| -import javax.swing.event.*; |
34 |
| -import javax.swing.plaf.*; |
| 43 | +import javax.swing.BoundedRangeModel; |
| 44 | +import javax.swing.JComponent; |
| 45 | +import javax.swing.JProgressBar; |
| 46 | +import javax.swing.LookAndFeel; |
| 47 | +import javax.swing.SwingUtilities; |
| 48 | +import javax.swing.Timer; |
| 49 | +import javax.swing.UIManager; |
| 50 | +import javax.swing.event.ChangeEvent; |
| 51 | +import javax.swing.event.ChangeListener; |
| 52 | +import javax.swing.plaf.ComponentUI; |
| 53 | +import javax.swing.plaf.ProgressBarUI; |
35 | 54 | import java.beans.PropertyChangeListener;
|
36 | 55 | import java.beans.PropertyChangeEvent;
|
37 |
| -import java.io.Serializable; |
38 | 56 | import sun.swing.DefaultLookup;
|
| 57 | +import sun.swing.SwingUtilities2; |
39 | 58 |
|
40 | 59 | /**
|
41 | 60 | * A Basic L&F implementation of ProgressBarUI.
|
@@ -1224,9 +1243,8 @@ private void initAnimationIndex() {
|
1224 | 1243 | private class Animator implements ActionListener {
|
1225 | 1244 | private Timer timer;
|
1226 | 1245 | private long previousDelay; //used to tune the repaint interval
|
1227 |
| - private int interval; //the fixed repaint interval |
1228 | 1246 | private long lastCall; //the last time actionPerformed was called
|
1229 |
| - private int MINIMUM_DELAY = 5; |
| 1247 | + private static final int MINIMUM_DELAY = 5; |
1230 | 1248 |
|
1231 | 1249 | /**
|
1232 | 1250 | * Creates a timer if one doesn't already exist,
|
@@ -1267,9 +1285,9 @@ public void actionPerformed(ActionEvent e) {
|
1267 | 1285 | if (lastCall > 0) { //adjust nextDelay
|
1268 | 1286 | //XXX maybe should cache this after a while
|
1269 | 1287 | //actual = time - lastCall
|
1270 |
| - //difference = actual - interval |
| 1288 | + //difference = actual - repaintInterval |
1271 | 1289 | //nextDelay = previousDelay - difference
|
1272 |
| - // = previousDelay - (time - lastCall - interval) |
| 1290 | + // = previousDelay - (time - lastCall - repaintInterval) |
1273 | 1291 | int nextDelay = (int)(previousDelay
|
1274 | 1292 | - time + lastCall
|
1275 | 1293 | + getRepaintInterval());
|
|
1 commit comments
openjdk-notifier[bot] commentedon Nov 2, 2024
Review
Issues