FileDocCategorySizeDatePackage
MotifButtonUI.javaAPI DocJava SE 5 API3907Fri Aug 26 14:54:46 BST 2005com.sun.java.swing.plaf.motif

MotifButtonUI

public class MotifButtonUI extends BasicButtonUI
MotifButton 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.26 12/19/03
author
Rich Schiavi

Fields Summary
private static final MotifButtonUI
motifButtonUI
protected Color
selectColor
private boolean
defaults_initialized
Constructors Summary
Methods Summary
protected javax.swing.plaf.basic.BasicButtonListenercreateButtonListener(javax.swing.AbstractButton b)

	return new MotifButtonListener(b);
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)

    
    // ********************************
    //          Create PLAF
    // ********************************
        
	return motifButtonUI;
    
protected voidfillContentArea(java.awt.Graphics g, javax.swing.AbstractButton b, java.awt.Color fillColor)


        if (b.isContentAreaFilled()) {
	    Insets margin = b.getMargin();
	    Insets insets = b.getInsets();
	    Dimension size = b.getSize();
	    g.setColor(fillColor);
	    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));
	}
    
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);
    
public voidpaint(java.awt.Graphics g, javax.swing.JComponent c)

        fillContentArea( g, (AbstractButton)c , c.getBackground() );   
	super.paint(g,c);
    
protected voidpaintButtonPressed(java.awt.Graphics g, javax.swing.AbstractButton b)


        fillContentArea( g, b , selectColor );

    
protected voidpaintFocus(java.awt.Graphics g, javax.swing.AbstractButton b, java.awt.Rectangle viewRect, java.awt.Rectangle textRect, java.awt.Rectangle iconRect)

	// focus painting is handled by the border
    
protected voidpaintIcon(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle iconRect)

        Shape oldClip = g.getClip();
        Rectangle newClip =
            AbstractBorder.getInteriorRectangle(c, c.getBorder(), 0, 0,
                                                c.getWidth(), c.getHeight());

        Rectangle r = oldClip.getBounds();
        newClip =
            SwingUtilities.computeIntersection(r.x, r.y, r.width, r.height,
                                               newClip);
        g.setClip(newClip);
        super.paintIcon(g, c, iconRect);
        g.setClip(oldClip);
    
protected voiduninstallDefaults(javax.swing.AbstractButton b)

	super.uninstallDefaults(b);
	defaults_initialized = false;