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

MotifPopupMenuUI

public class MotifPopupMenuUI extends BasicPopupMenuUI
A Motif L&F implementation of PopupMenuUI.

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.25 12/19/03
author
Georges Saab
author
Rich Schiavi

Fields Summary
private static Border
border
private Font
titleFont
Constructors Summary
Methods Summary
protected javax.swing.event.ChangeListenercreateChangeListener(javax.swing.JPopupMenu m)

	return new ChangeListener() {
	    public void stateChanged(ChangeEvent e) {}
	};
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent x)


         
	return new MotifPopupMenuUI();
    
public java.awt.DimensiongetPreferredSize(javax.swing.JComponent c)

	LayoutManager layout = c.getLayout();
	Dimension d = layout.preferredLayoutSize(c);
	String title = ((JPopupMenu)c).getLabel();
	if (titleFont == null) {
	    UIDefaults table = UIManager.getLookAndFeelDefaults();
	    titleFont = table.getFont("PopupMenu.font");
	}
	FontMetrics fm = c.getFontMetrics(titleFont);
	int         stringWidth = 0;
        
        if (title!=null) {
            stringWidth += SwingUtilities2.stringWidth(c, fm, title);
        }

	if (d.width < stringWidth) {
	    d.width = stringWidth + 8;
	    Insets i = c.getInsets();
	    if (i!=null) {
		d.width += i.left + i.right;
	    }
	    if (border != null) {
		i = border.getBorderInsets(c);
		d.width += i.left + i.right;
	    }

	    return d;
	}
	return null;
    
public booleanisPopupTrigger(java.awt.event.MouseEvent e)

	return ((e.getID()==MouseEvent.MOUSE_PRESSED) 
		&& ((e.getModifiers() & MouseEvent.BUTTON3_MASK)!=0));