001    /*
002     * Copyright (c) 2005, romain guy (romain.guy@jext.org) and craig wickesser (craig@codecraig.com)
003     * All rights reserved.
004     * 
005     * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
006     * 
007     *     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
008     *     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
009     *     * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
010     * 
011     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
012     * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
013     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
014     * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
015     * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
016     * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
017     * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
018     * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
019     * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
020     * POSSIBILITY OF SUCH DAMAGE.
021     */
022    
023    package net.java.swingfx.jdraggable.demo;
024    
025    import java.awt.Color;
026    import java.awt.Component;
027    
028    import javax.swing.JLabel;
029    import javax.swing.border.LineBorder;
030    import javax.swing.border.TitledBorder;
031    
032    import net.java.swingfx.jdraggable.Draggable;
033    
034    
035    /**
036     * A {@link javax.swing.JLabel} which implements the {@link net.java.swingfx.jdraggable.Draggable}
037     * interface
038     * 
039     * @author craig
040     * @since v0.1
041     * <br>
042     * $Header: /cvs/swingfx/docs/api/src-html/net/java/swingfx/jdraggable/demo/DraggableLabel.html,v 1.1 2005/06/23 00:24:51 codecraig Exp $
043     */
044    public class DraggableLabel extends JLabel implements Draggable {
045            private static final long serialVersionUID = 3544671789059028281L;
046    
047            public DraggableLabel(String text) {
048                    super(text);
049                    setBorder(new TitledBorder(new LineBorder(Color.RED), "JLabel"));
050            }
051            
052            /* (non-Javadoc)
053             * @see com.codecraig.jdraggable.Draggable#getComponent()
054             */
055            public Component getComponent() {
056                    return this;
057            }
058    }