001 /* 002 * $Id: MetalTaskPaneUI.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.metal; 022 023 import java.awt.Graphics; 024 import java.awt.Graphics2D; 025 import java.awt.RenderingHints; 026 027 import javax.swing.JComponent; 028 import javax.swing.LookAndFeel; 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 * Metal implementation of the <code>JXTaskPane</code> UI. <br> 037 * 038 * @author <a href="mailto:fred@L2FProd.com">Frederic Lavigne</a> 039 */ 040 public class MetalTaskPaneUI extends BasicTaskPaneUI { 041 042 public static ComponentUI createUI(JComponent c) { 043 return new MetalTaskPaneUI(); 044 } 045 046 protected void installDefaults() { 047 super.installDefaults(); 048 049 LookAndFeel.installProperty(group, "opaque", false); 050 } 051 052 protected Border createPaneBorder() { 053 return new MetalPaneBorder(); 054 } 055 056 /** 057 * The border of the task pane group paints the "text", the "icon", 058 * the "expanded" status and the "special" type. 059 * 060 */ 061 class MetalPaneBorder 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 g.setColor(getPaintColor(group)); 070 paintRectAroundControls(group, g, x, y, width, height, g.getColor(), g 071 .getColor()); 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 @Override 080 protected boolean isMouseOverBorder() { 081 return true; 082 } 083 } 084 085 }