How do I change Swing Timer Delay inside actionPerformed()
So I'm building this music player app which plays notes which are dragged and dropped onto a JLabel. When I hit the play button, I want each note to be highlighted with a delay value corresponding to that note. I used a Swing Timer for this but the problem is, it just loops with a constant delay which is specified in the constructor. playButton.addActionListener(e -> { timerI = 0; System.out.println("Entered onAction"); Timer t = new Timer(1000, e1 -> { if (timerI < 24) { NoteLabel thisNote = (NoteLabel)staff.getComponent(timerI); NoteIcon thisIcon = thisNote.getIcon(); String noteName =