1 7 8 package com.sun.java.swing.plaf.windows; 9 10 import java.awt.*; 11 import javax.swing.plaf.*; 12 import javax.swing.plaf.basic.*; 13 import javax.swing.*; 14 import javax.swing.border.*; 15 16 17 18 28 public class WindowsDesktopIconUI extends BasicDesktopIconUI { 29 private int width; 30 31 public static ComponentUI createUI(JComponent c) { 32 return new WindowsDesktopIconUI(); 33 } 34 35 public void installDefaults() { 36 super.installDefaults(); 37 width = UIManager.getInt("DesktopIcon.width"); 38 } 39 40 public void installUI(JComponent c) { 41 super.installUI(c); 42 43 c.setOpaque(XPStyle.getXP() == null); 44 } 45 46 public void uninstallUI(JComponent c) { 48 WindowsInternalFrameTitlePane thePane = 49 (WindowsInternalFrameTitlePane)iconPane; 50 super.uninstallUI(c); 51 thePane.uninstallListeners(); 52 } 53 54 protected void installComponents() { 55 iconPane = new WindowsInternalFrameTitlePane(frame); 56 desktopIcon.setLayout(new BorderLayout()); 57 desktopIcon.add(iconPane, BorderLayout.CENTER); 58 59 if (XPStyle.getXP() != null) { 60 desktopIcon.setBorder(null); 61 } 62 } 63 64 public Dimension getPreferredSize(JComponent c) { 65 return getMinimumSize(c); 69 } 70 71 75 public Dimension getMinimumSize(JComponent c) { 76 Dimension dim = super.getMinimumSize(c); 77 dim.width = width; 78 return dim; 79 } 80 } 81 | Popular Tags |