Package com.sun.java.swing.plaf.motif

Source Code of com.sun.java.swing.plaf.motif.MotifRadioButtonUI

/*
* @(#)MotifRadioButtonUI.java  1.24 09/08/10
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/

package com.sun.java.swing.plaf.motif;

import sun.awt.AppContext;

import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.basic.BasicRadioButtonUI;

import javax.swing.plaf.*;

import java.awt.*;

/**
* RadioButtonUI implementation for MotifRadioButtonUI
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases.  The current serialization support is appropriate
* for short term storage or RMI between applications running the same
* version of Swing.  A future release of Swing will provide support for
* long term persistence.
*
* @version 1.24 08/10/09
* @author Rich Schiavi
*/
public class MotifRadioButtonUI extends BasicRadioButtonUI {

    private static final Object MOTIF_RADIO_BUTTON_UI_KEY = new Object();

    protected Color focusColor;

    private boolean defaults_initialized = false;
   
    // ********************************
    //         Create PLAF
    // ********************************
    public static ComponentUI createUI(JComponent c) {
        AppContext appContext = AppContext.getAppContext();
        MotifRadioButtonUI motifRadioButtonUI =
                (MotifRadioButtonUI) appContext.get(MOTIF_RADIO_BUTTON_UI_KEY);
        if (motifRadioButtonUI == null) {
            motifRadioButtonUI = new MotifRadioButtonUI();
            appContext.put(MOTIF_RADIO_BUTTON_UI_KEY, motifRadioButtonUI);
        }
        return motifRadioButtonUI;
    }

    // ********************************
    //          Install Defaults
    // ********************************
    public void installDefaults(AbstractButton b) {
  super.installDefaults(b);
  if(!defaults_initialized) {
      focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
      defaults_initialized = true;
  }
    }

    protected void uninstallDefaults(AbstractButton b) {
  super.uninstallDefaults(b);
  defaults_initialized = false;
    }
   
    // ********************************
    //          Default Accessors
    // ********************************

    protected Color getFocusColor() {
  return focusColor;
    }
   
    // ********************************
    //         Paint Methods
    // ********************************
    protected void paintFocus(Graphics g, Rectangle t, Dimension d){
  g.setColor(getFocusColor());
  g.drawRect(0,0,d.width-1,d.height-1);
    }
   
TOP

Related Classes of com.sun.java.swing.plaf.motif.MotifRadioButtonUI

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.