001 /*
002 * $Id: BasicBusyLabelUI.java 2669 2008-02-06 04:25:46Z kschaefe $
003 *
004 * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
005 * Santa Clara, California 95054, U.S.A. All rights reserved.
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public
018 * License along with this library; if not, write to the Free Software
019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
020 */
021 package org.jdesktop.swingx.plaf.basic;
022 import java.awt.Color;
023 import java.awt.Dimension;
024 import java.awt.Shape;
025
026 import javax.swing.JComponent;
027 import javax.swing.UIManager;
028 import javax.swing.plaf.ComponentUI;
029 import javax.swing.plaf.basic.BasicLabelUI;
030
031 import org.jdesktop.swingx.JXBusyLabel;
032 import org.jdesktop.swingx.painter.BusyPainter;
033 import org.jdesktop.swingx.plaf.BusyLabelUI;
034 import org.jdesktop.swingx.plaf.UIManagerExt;
035
036 /**
037 * Base implementation of the <code>JXBusyLabel</code> UI.
038 *
039 * @author rah003
040 */
041 public class BasicBusyLabelUI extends BasicLabelUI implements BusyLabelUI {
042
043 /** Creates a new instance of BasicBusyLabelUI */
044 public BasicBusyLabelUI(JXBusyLabel lbl) {
045 }
046
047 public static ComponentUI createUI(JComponent c) {
048 return new BasicBusyLabelUI((JXBusyLabel)c);
049 }
050
051 public BusyPainter getBusyPainter(final Dimension dim) {
052 BusyPainter p = new BusyPainter() {
053 @Override
054 protected void init(Shape point, Shape trajectory, Color b, Color h) {
055 super.init(dim == null ? UIManagerExt.getShape("JXBusyLabel.pointShape") : getScaledDefaultPoint(dim.height),
056 dim == null ? UIManagerExt.getShape("JXBusyLabel.trajectoryShape") : getScaledDefaultTrajectory(dim.height),
057 UIManagerExt.getSafeColor("JXBusyLabel.baseColor", Color.LIGHT_GRAY),
058 UIManagerExt.getSafeColor("JXBusyLabel.highlightColor", Color.BLACK));
059 }
060 };
061 return p;
062 }
063
064 public int getDelay() {
065 return UIManager.getInt("JXBusyLabel.delay");
066 }
067
068
069 }