You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.6 KiB
105 lines
2.6 KiB
6 years ago
|
/*
|
||
|
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
|
||
|
* ORACLE 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.
|
||
|
*
|
||
|
* @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);
|
||
|
}
|
||
|
|
||
|
}
|