KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > gui > util > MenuThrobber


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.core.gui.util;
19
20 import java.awt.BorderLayout JavaDoc;
21 import java.awt.Component JavaDoc;
22
23 import javax.swing.Box JavaDoc;
24 import javax.swing.JMenuBar JavaDoc;
25 import javax.swing.JPanel JavaDoc;
26
27
28 /**
29  * Utility class to add a throbber into the right-hand side corner
30  * of a JMenuBar.
31  *
32  * @author fdietz
33  */

34 public class MenuThrobber {
35
36     public static void setThrobber(JMenuBar JavaDoc menuBar) {
37         if ( menuBar == null ) throw new IllegalArgumentException JavaDoc("menuBar == null");
38         
39         Component JavaDoc box = Box.createHorizontalGlue();
40         menuBar.add(box);
41         
42         JPanel JavaDoc throbberPanel = new JPanel JavaDoc();
43         throbberPanel.setLayout(new BorderLayout JavaDoc());
44         throbberPanel.add(new ThrobberIcon(), BorderLayout.EAST);
45         
46         menuBar.add(throbberPanel);
47     }
48 }
49
Popular Tags