001 /* 002 * $Id: WindowsHyperlinkUI.java 3188 2009-01-20 16:22:37Z 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.Graphics; 024 025 import javax.swing.AbstractButton; 026 import javax.swing.BorderFactory; 027 import javax.swing.JComponent; 028 import javax.swing.plaf.BorderUIResource; 029 import javax.swing.plaf.ComponentUI; 030 import javax.swing.plaf.UIResource; 031 032 import org.jdesktop.swingx.plaf.basic.BasicHyperlinkUI; 033 034 /** 035 * Extends BasicHyperlinkUI and paints the text with an offset when mouse 036 * pressed.<br> 037 * 038 * @deprecated pre-0.9.4 PENDING JW: why is this deprecated? What to use 039 * instead? kgs: clearly installDefaults can go away, but I 040 * distinctly recall that setTextShiftOffset was at one point 041 * uncommented in parent, leaving no differences with child. That is 042 * no longer the case. 043 */ 044 @Deprecated 045 public class WindowsHyperlinkUI extends BasicHyperlinkUI { 046 047 public static ComponentUI createUI(JComponent c) { 048 return new WindowsHyperlinkUI(); 049 } 050 051 /** 052 * {@inheritDoc} 053 */ 054 @Override 055 protected void paintButtonPressed(Graphics g, AbstractButton b) { 056 setTextShiftOffset(); 057 } 058 059 /** 060 * {@inheritDoc} 061 */ 062 @Override 063 protected void installDefaults(AbstractButton b) { 064 super.installDefaults(b); 065 if (b.getBorder() == null || b.getBorder() instanceof UIResource) { 066 b.setBorder(new BorderUIResource(BorderFactory.createEmptyBorder(0, 1, 0, 0))); 067 } 068 } 069 }