001 /* 002 * $Id: WindowsClassicTaskPaneUI.java 3344 2009-05-25 01:46:59Z 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.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.LookAndFeel; 030 import javax.swing.border.Border; 031 import javax.swing.plaf.ComponentUI; 032 033 import org.jdesktop.swingx.JXTaskPane; 034 import 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 */ 042 public class WindowsClassicTaskPaneUI extends BasicTaskPaneUI { 043 044 public static ComponentUI createUI(JComponent c) { 045 return new WindowsClassicTaskPaneUI(); 046 } 047 048 protected void installDefaults() { 049 super.installDefaults(); 050 051 LookAndFeel.installProperty(group, "opaque", false); 052 } 053 054 protected Border createPaneBorder() { 055 return new ClassicPaneBorder(); 056 } 057 058 /** 059 * The border of the taskpane group paints the "text", the "icon", the 060 * "expanded" status and the "special" type. 061 * 062 */ 063 class ClassicPaneBorder extends PaneBorder { 064 065 protected void paintExpandedControls(JXTaskPane group, Graphics g, int x, 066 int y, int width, int height) { 067 ((Graphics2D)g).setRenderingHint( 068 RenderingHints.KEY_ANTIALIASING, 069 RenderingHints.VALUE_ANTIALIAS_ON); 070 071 paintRectAroundControls(group, g, x, y, width, height, Color.white, 072 Color.gray); 073 g.setColor(getPaintColor(group)); 074 paintChevronControls(group, g, x, y, width, height); 075 076 ((Graphics2D)g).setRenderingHint( 077 RenderingHints.KEY_ANTIALIASING, 078 RenderingHints.VALUE_ANTIALIAS_OFF); 079 } 080 } 081 082 }