2
* SwingBugUtilities.java
4
* Created on March 30, 2007, 12:27 AM
6
* Copyright 2006-2007 Nigel Hughes
8
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
9
* in compliance with the License. You may obtain a copy of the License at http://www.apache.org/
10
* licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
13
* governing permissions and limitations under the License.
16
package org.pushingpixels.lafwidget.contrib.blogofbug.swing;
18
import java.awt.event.ActionEvent;
19
import java.awt.event.ActionListener;
20
import javax.swing.Timer;
23
* Contains some utility methods applicable to any swing application.
27
public class SwingBugUtilities {
29
/** Creates a new instance of SwingBugUtilities */
30
private SwingBugUtilities() {
34
* Runs the supplied class after a certain period of time, the thread
35
* will be executed in the EDT.
37
* @param execute The runnable object whose method will be called after the
39
* @param after The delay in ms before the event will be called
41
public static void invokeAfter(final Runnable execute, int after){
42
Timer timer = new Timer(after,new ActionListener() {
44
public void actionPerformed(ActionEvent actionEvent) {
49
timer.setRepeats(false);