001    /*
002     * $Id: WindowsClassicTaskPaneUI.java,v 1.4 2005/10/10 18:02:26 rbair Exp $
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.windows;
022    
023    import java.awt.Color;
024    import java.awt.Graphics;
025    import java.awt.Graphics2D;
026    import java.awt.RenderingHints;
027    
028    import javax.swing.JComponent;
029    import javax.swing.border.Border;
030    import javax.swing.plaf.ComponentUI;
031    
032    import org.jdesktop.swingx.JXTaskPane;
033    import org.jdesktop.swingx.plaf.basic.BasicTaskPaneUI;
034    
035    /**
036     * Windows Classic (NT/2000) implementation of the
037     * <code>JXTaskPane</code> UI.
038     * 
039     * @author <a href="mailto:fred@L2FProd.com">Frederic Lavigne</a>
040     */
041    public class WindowsClassicTaskPaneUI extends BasicTaskPaneUI {
042    
043      public static ComponentUI createUI(JComponent c) {
044        return new WindowsClassicTaskPaneUI();
045      }
046    
047      protected void installDefaults() {
048        super.installDefaults();
049        group.setOpaque(false);
050      }
051    
052      protected Border createPaneBorder() {
053        return new ClassicPaneBorder();
054      }
055    
056      /**
057       * The border of the taskpane group paints the "text", the "icon", the
058       * "expanded" status and the "special" type.
059       *  
060       */
061      class ClassicPaneBorder extends PaneBorder {
062    
063        protected void paintExpandedControls(JXTaskPane group, Graphics g, int x,
064          int y, int width, int height) {
065          ((Graphics2D)g).setRenderingHint(
066            RenderingHints.KEY_ANTIALIASING,
067            RenderingHints.VALUE_ANTIALIAS_ON);
068          
069          paintRectAroundControls(group, g, x, y, width, height, Color.white,
070            Color.gray);
071          g.setColor(getPaintColor(group));
072          paintChevronControls(group, g, x, y, width, height);
073          
074          ((Graphics2D)g).setRenderingHint(
075            RenderingHints.KEY_ANTIALIASING,
076            RenderingHints.VALUE_ANTIALIAS_OFF);
077        }
078      }
079    
080    }