jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java
changeset 1277 61e297d24425
parent 2 90ce3da70b43
child 3345 e095f8b1c3e8
equal deleted inserted replaced
1276:5c7b6c8a2378 1277:61e297d24425
     1 /*
     1 /*
     2  * Copyright 1997-2003 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Sun designates this
     7  * published by the Free Software Foundation.  Sun designates this
    45  */
    45  */
    46 public class BasicDesktopIconUI extends DesktopIconUI {
    46 public class BasicDesktopIconUI extends DesktopIconUI {
    47 
    47 
    48     protected JInternalFrame.JDesktopIcon desktopIcon;
    48     protected JInternalFrame.JDesktopIcon desktopIcon;
    49     protected JInternalFrame frame;
    49     protected JInternalFrame frame;
       
    50     private DesktopIconMover desktopIconMover;
    50 
    51 
    51     /**
    52     /**
    52      * The title pane component used in the desktop icon.
    53      * The title pane component used in the desktop icon.
    53      *
    54      *
    54      * @since 1.5
    55      * @since 1.5
   125 
   126 
   126     protected void installListeners() {
   127     protected void installListeners() {
   127         mouseInputListener = createMouseInputListener();
   128         mouseInputListener = createMouseInputListener();
   128         desktopIcon.addMouseMotionListener(mouseInputListener);
   129         desktopIcon.addMouseMotionListener(mouseInputListener);
   129         desktopIcon.addMouseListener(mouseInputListener);
   130         desktopIcon.addMouseListener(mouseInputListener);
       
   131          getDesktopIconMover().installListeners();
   130     }
   132     }
   131 
   133 
   132     protected void uninstallListeners() {
   134     protected void uninstallListeners() {
   133         desktopIcon.removeMouseMotionListener(mouseInputListener);
   135         desktopIcon.removeMouseMotionListener(mouseInputListener);
   134         desktopIcon.removeMouseListener(mouseInputListener);
   136         desktopIcon.removeMouseListener(mouseInputListener);
   135         mouseInputListener = null;
   137         mouseInputListener = null;
       
   138          getDesktopIconMover().uninstallListeners();
       
   139     }
       
   140 
       
   141     private DesktopIconMover getDesktopIconMover() {
       
   142         if (desktopIconMover == null) {
       
   143             desktopIconMover = new DesktopIconMover(desktopIcon);
       
   144         }
       
   145         return desktopIconMover;
   136     }
   146     }
   137 
   147 
   138     protected void installDefaults() {
   148     protected void installDefaults() {
   139         LookAndFeel.installBorder(desktopIcon, "DesktopIcon.border");
   149         LookAndFeel.installBorder(desktopIcon, "DesktopIcon.border");
   140         LookAndFeel.installProperty(desktopIcon, "opaque", Boolean.TRUE);
   150         LookAndFeel.installProperty(desktopIcon, "opaque", Boolean.TRUE);