Methods Summary |
---|
protected javax.swing.event.MouseInputListener | createMouseInputListener()
return new MouseInputHandler();
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent c)
return new BasicDesktopIconUI();
|
public void | deiconize()
try { frame.setIcon(false); } catch (PropertyVetoException e2) { }
|
public java.awt.Insets | getInsets(javax.swing.JComponent c)
JInternalFrame iframe = desktopIcon.getInternalFrame();
Border border = iframe.getBorder();
if(border != null)
return border.getBorderInsets(iframe);
return new Insets(0,0,0,0);
|
public java.awt.Dimension | getMaximumSize(javax.swing.JComponent c)Desktop icons can not be resized. Therefore, we should always
return the minimum size of the desktop icon.
return iconPane.getMaximumSize();
|
public java.awt.Dimension | getMinimumSize(javax.swing.JComponent c)
Dimension dim = new Dimension(iconPane.getMinimumSize());
Border border = frame.getBorder();
if (border != null) {
dim.height += border.getBorderInsets(frame).bottom +
border.getBorderInsets(frame).top;
}
return dim;
|
public java.awt.Dimension | getPreferredSize(javax.swing.JComponent c)
return desktopIcon.getLayout().preferredLayoutSize(desktopIcon);
|
protected void | installComponents()
iconPane = new BasicInternalFrameTitlePane(frame);
desktopIcon.setLayout(new BorderLayout());
desktopIcon.add(iconPane, BorderLayout.CENTER);
|
protected void | installDefaults()
LookAndFeel.installBorder(desktopIcon, "DesktopIcon.border");
LookAndFeel.installProperty(desktopIcon, "opaque", Boolean.TRUE);
|
protected void | installListeners()
mouseInputListener = createMouseInputListener();
desktopIcon.addMouseMotionListener(mouseInputListener);
desktopIcon.addMouseListener(mouseInputListener);
|
public void | installUI(javax.swing.JComponent c)
desktopIcon = (JInternalFrame.JDesktopIcon)c;
frame = desktopIcon.getInternalFrame();
installDefaults();
installComponents();
// Update icon layout if frame is already iconified
JInternalFrame f = desktopIcon.getInternalFrame();
if (f.isIcon() && f.getParent() == null) {
JDesktopPane desktop = desktopIcon.getDesktopPane();
if (desktop != null) {
DesktopManager desktopManager = desktop.getDesktopManager();
if (desktopManager instanceof DefaultDesktopManager) {
desktopManager.iconifyFrame(f);
}
}
}
installListeners();
JLayeredPane.putLayer(desktopIcon, JLayeredPane.getLayer(frame));
|
protected void | uninstallComponents()
desktopIcon.remove(iconPane);
desktopIcon.setLayout(null);
iconPane = null;
|
protected void | uninstallDefaults()
LookAndFeel.uninstallBorder(desktopIcon);
|
protected void | uninstallListeners()
desktopIcon.removeMouseMotionListener(mouseInputListener);
desktopIcon.removeMouseListener(mouseInputListener);
mouseInputListener = null;
|
public void | uninstallUI(javax.swing.JComponent c)
uninstallDefaults();
uninstallComponents();
// Force future UI to relayout icon
JInternalFrame f = desktopIcon.getInternalFrame();
if (f.isIcon()) {
JDesktopPane desktop = desktopIcon.getDesktopPane();
if (desktop != null) {
DesktopManager desktopManager = desktop.getDesktopManager();
if (desktopManager instanceof DefaultDesktopManager) {
// This will cause DefaultDesktopManager to layout the icon
f.putClientProperty("wasIconOnce", null);
// Move aside to allow fresh layout of all icons
desktopIcon.setLocation(Integer.MIN_VALUE, 0);
}
}
}
uninstallListeners();
frame = null;
desktopIcon = null;
|