Rev | Line | |
---|
[18091] | 1 | package org.greenstone.gsdl3_extension.mat;
|
---|
| 2 |
|
---|
| 3 | import java.awt.Component;
|
---|
| 4 | import java.awt.Cursor;
|
---|
| 5 | import java.awt.event.ActionEvent;
|
---|
| 6 | import java.awt.event.ActionListener;
|
---|
| 7 |
|
---|
| 8 | public final class CursorController {
|
---|
| 9 |
|
---|
| 10 | public final static Cursor busyCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
|
---|
| 11 | public final static Cursor defaultCursor = Cursor.getDefaultCursor();
|
---|
| 12 | private CursorController() {}
|
---|
| 13 |
|
---|
| 14 | public static ActionListener createListener(final Component component, final ActionListener mainActionListener) {
|
---|
| 15 | ActionListener actionListener = new ActionListener() {
|
---|
| 16 | public void actionPerformed(ActionEvent ae) {
|
---|
| 17 | try {
|
---|
| 18 | component.setCursor(busyCursor);
|
---|
| 19 | mainActionListener.actionPerformed(ae);
|
---|
| 20 | } finally {
|
---|
| 21 | component.setCursor(defaultCursor);
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 | };
|
---|
| 25 | return actionListener;
|
---|
| 26 | }
|
---|
| 27 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.