Skip to content

Commit

Permalink
8342082: Remove unused BasicProgressBarUI.Animator.interval
Browse files Browse the repository at this point in the history
Reviewed-by: prr, honkar
  • Loading branch information
Andrey Turbanov committed Nov 2, 2024
1 parent 00ec105 commit 069bb79
Showing 1 changed file with 30 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,17 +25,36 @@

package javax.swing.plaf.basic;

import sun.swing.SwingUtilities2;
import java.awt.*;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import java.awt.geom.AffineTransform;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.BoundedRangeModel;
import javax.swing.JComponent;
import javax.swing.JProgressBar;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ProgressBarUI;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.io.Serializable;
import sun.swing.DefaultLookup;
import sun.swing.SwingUtilities2;

/**
* A Basic L&F implementation of ProgressBarUI.
Expand Down Expand Up @@ -1224,9 +1243,8 @@ private void initAnimationIndex() {
private class Animator implements ActionListener {
private Timer timer;
private long previousDelay; //used to tune the repaint interval
private int interval; //the fixed repaint interval
private long lastCall; //the last time actionPerformed was called
private int MINIMUM_DELAY = 5;
private static final int MINIMUM_DELAY = 5;

/**
* Creates a timer if one doesn't already exist,
Expand Down Expand Up @@ -1267,9 +1285,9 @@ public void actionPerformed(ActionEvent e) {
if (lastCall > 0) { //adjust nextDelay
//XXX maybe should cache this after a while
//actual = time - lastCall
//difference = actual - interval
//difference = actual - repaintInterval
//nextDelay = previousDelay - difference
// = previousDelay - (time - lastCall - interval)
// = previousDelay - (time - lastCall - repaintInterval)
int nextDelay = (int)(previousDelay
- time + lastCall
+ getRepaintInterval());
Expand Down

0 comments on commit 069bb79

Please sign in to comment.