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