1 /* 2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.swing.plaf.synth; 27 28 import java.awt.*; 29 import javax.swing.*; 30 import javax.swing.plaf.*; 31 32 /** 33 * Provides the Synth L&F UI delegate for 34 * {@link javax.swing.JRadioButton}. 35 * 36 * @author Jeff Dinkins 37 * @since 1.7 38 */ 39 public class SynthRadioButtonUI extends SynthToggleButtonUI { 40 41 // ******************************** 42 // Create PLAF 43 // ******************************** 44 /** 45 * Creates a new UI object for the given component. 46 * 47 * @param b component to create UI object for 48 * @return the UI object 49 */ createUI(JComponent b)50 public static ComponentUI createUI(JComponent b) { 51 return new SynthRadioButtonUI(); 52 } 53 54 /** 55 * {@inheritDoc} 56 */ 57 @Override getPropertyPrefix()58 protected String getPropertyPrefix() { 59 return "RadioButton."; 60 } 61 62 /** 63 * Returns the Icon used in calculating the 64 * preferred/minimum/maximum size. 65 */ 66 @Override getSizingIcon(AbstractButton b)67 protected Icon getSizingIcon(AbstractButton b) { 68 return getIcon(b); 69 } 70 71 @Override paintBackground(SynthContext context, Graphics g, JComponent c)72 void paintBackground(SynthContext context, Graphics g, JComponent c) { 73 context.getPainter().paintRadioButtonBackground(context, g, 0, 0, 74 c.getWidth(), c.getHeight()); 75 } 76 77 /** 78 * {@inheritDoc} 79 */ 80 @Override paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)81 public void paintBorder(SynthContext context, Graphics g, int x, 82 int y, int w, int h) { 83 context.getPainter().paintRadioButtonBorder(context, g, x, y, w, h); 84 } 85 } 86