FileDocCategorySizeDatePackage
MotifDesktopIconUI.javaAPI DocJava SE 6 API11117Tue Jun 10 00:21:56 BST 2008com.sun.java.swing.plaf.motif

MotifDesktopIconUI

public class MotifDesktopIconUI extends BasicDesktopIconUI
Motif rendition of the component.
version
1.29 11/30/05
author
Thomas Ball
author
Rich Schiavi

Fields Summary
protected DesktopIconActionListener
desktopIconActionListener
protected DesktopIconMouseListener
desktopIconMouseListener
protected Icon
defaultIcon
protected IconButton
iconButton
protected IconLabel
iconLabel
private MotifInternalFrameTitlePane
sysMenuTitlePane
JPopupMenu
systemMenu
EventListener
mml
static final int
LABEL_HEIGHT
static final int
LABEL_DIVIDER
static final Font
defaultTitleFont
Constructors Summary
public MotifDesktopIconUI()

    
Methods Summary
protected com.sun.java.swing.plaf.motif.MotifDesktopIconUI$DesktopIconActionListenercreateDesktopIconActionListener()

	return new DesktopIconActionListener();
    
protected com.sun.java.swing.plaf.motif.MotifDesktopIconUI$DesktopIconMouseListenercreateDesktopIconMouseListener()

	return new DesktopIconMouseListener();
    
protected com.sun.java.swing.plaf.motif.MotifDesktopIconUI$IconButtoncreateIconButton(javax.swing.Icon i)

	return new IconButton(i);
    
protected com.sun.java.swing.plaf.motif.MotifDesktopIconUI$IconLabelcreateIconLabel(javax.swing.JInternalFrame frame)

	return new IconLabel(frame);
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)


            
        return new MotifDesktopIconUI();
    
public javax.swing.IcongetDefaultIcon()
Returns the default desktop icon.

	return defaultIcon;
    
javax.swing.JInternalFrame$JDesktopIcongetDesktopIcon()

      return desktopIcon;
    
javax.swing.JInternalFramegetFrame()

      return frame;
    
public java.awt.DimensiongetMaximumSize(javax.swing.JComponent c)

        return getMinimumSize(c);
    
public java.awt.DimensiongetMinimumSize(javax.swing.JComponent c)

        JInternalFrame iframe = desktopIcon.getInternalFrame();
	
        int w = defaultIcon.getIconWidth();
        int h = defaultIcon.getIconHeight() + LABEL_HEIGHT + LABEL_DIVIDER;

	Border border = iframe.getBorder();
	if(border != null) {
	    w += border.getBorderInsets(iframe).left + 
                border.getBorderInsets(iframe).right;
	    h += border.getBorderInsets(iframe).bottom + 
                border.getBorderInsets(iframe).top;
        }

	return new Dimension(w, h);
    
public java.awt.DimensiongetPreferredSize(javax.swing.JComponent c)

        return getMinimumSize(c);
    
protected voidhideSystemMenu()

      systemMenu.setVisible(false);
    
protected voidinstallComponents()

    
protected voidinstallDefaults()

	super.installDefaults();
	setDefaultIcon(UIManager.getIcon("DesktopIcon.icon"));
	iconButton = createIconButton(defaultIcon);
        // An underhanded way of creating a system popup menu.
        sysMenuTitlePane =  new MotifInternalFrameTitlePane(frame);
        systemMenu = sysMenuTitlePane.getSystemMenu();

        MotifBorders.FrameBorder border = new MotifBorders.FrameBorder(desktopIcon);
	desktopIcon.setLayout(new BorderLayout());
        iconButton.setBorder(border);
	desktopIcon.add(iconButton, BorderLayout.CENTER);
        iconLabel = createIconLabel(frame);
        iconLabel.setBorder(border);
        desktopIcon.add(iconLabel, BorderLayout.SOUTH);
        desktopIcon.setSize(desktopIcon.getPreferredSize());
        desktopIcon.validate();
	JLayeredPane.putLayer(desktopIcon, JLayeredPane.getLayer(frame));
    
protected voidinstallListeners()

	super.installListeners();
	desktopIconActionListener = createDesktopIconActionListener();
	desktopIconMouseListener = createDesktopIconMouseListener();
	iconButton.addActionListener(desktopIconActionListener);
	iconButton.addMouseListener(desktopIconMouseListener);
        iconLabel.addMouseListener(desktopIconMouseListener);
    
public voidsetDefaultIcon(javax.swing.Icon newIcon)
Sets the icon used as the default desktop icon.

	defaultIcon = newIcon;
    
voidsetDesktopIcon(javax.swing.JInternalFrame$JDesktopIcon d)

      desktopIcon = d;
    
voidsetFrame(javax.swing.JInternalFrame f)

      frame = f ;
    
protected voidshowSystemMenu()

      systemMenu.show(iconButton, 0, getDesktopIcon().getHeight());
    
protected voiduninstallComponents()

    
protected voiduninstallDefaults()

	super.uninstallDefaults();
	desktopIcon.setLayout(null);
	desktopIcon.remove(iconButton);
	desktopIcon.remove(iconLabel);
    
protected voiduninstallListeners()

        super.uninstallListeners();
        iconButton.removeActionListener(desktopIconActionListener);
        iconButton.removeMouseListener(desktopIconMouseListener);
        sysMenuTitlePane.uninstallListeners();