FileDocCategorySizeDatePackage
MotifToggleButtonUI.javaAPI DocJava SE 5 API2900Fri Aug 26 14:54:48 BST 2005com.sun.java.swing.plaf.motif

MotifToggleButtonUI

public class MotifToggleButtonUI extends BasicToggleButtonUI
BasicToggleButton implementation

Warning: 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.21 12/19/03
author
Rich Schiavi

Fields Summary
private static final MotifToggleButtonUI
motifToggleButtonUI
protected Color
selectColor
private boolean
defaults_initialized
Constructors Summary
Methods Summary
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent b)

    
    // ********************************
    //         Create PLAF
    // ********************************
         
	return motifToggleButtonUI;
    
public java.awt.InsetsgetInsets(javax.swing.JComponent c)

 
	Border border = c.getBorder();
	Insets i = border != null? border.getBorderInsets(c) : new Insets(0,0,0,0);
	return i;
    
protected java.awt.ColorgetSelectColor()

	return selectColor;
    
public voidinstallDefaults(javax.swing.AbstractButton b)

	super.installDefaults(b);
	if(!defaults_initialized) {
	    selectColor = UIManager.getColor(getPropertyPrefix() + "select");
	    defaults_initialized = true;
	}
        LookAndFeel.installProperty(b, "opaque", Boolean.FALSE);
    
protected voidpaintButtonPressed(java.awt.Graphics g, javax.swing.AbstractButton b)

        if (b.isContentAreaFilled()) {
	    Color oldColor = g.getColor();
	    Dimension size = b.getSize();
	    Insets insets = b.getInsets();
	    Insets margin = b.getMargin();

	    if(b.getBackground() instanceof UIResource) {
		g.setColor(getSelectColor());
	    }
	    g.fillRect(insets.left - margin.left,
		       insets.top - margin.top, 
		       size.width - (insets.left-margin.left) - (insets.right - margin.right),
		       size.height - (insets.top-margin.top) - (insets.bottom - margin.bottom));
	    g.setColor(oldColor);
	}
    
protected voiduninstallDefaults(javax.swing.AbstractButton b)

	super.uninstallDefaults(b);
	defaults_initialized = false;