38 |
|
|
39 |
package javax.swing.plaf.metal; |
package javax.swing.plaf.metal; |
40 |
|
|
|
import java.util.HashMap; |
|
|
|
|
41 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
42 |
import javax.swing.JInternalFrame; |
import javax.swing.JInternalFrame; |
43 |
import javax.swing.border.EmptyBorder; |
import javax.swing.border.EmptyBorder; |
44 |
import javax.swing.plaf.ComponentUI; |
import javax.swing.plaf.ComponentUI; |
45 |
import javax.swing.plaf.basic.BasicInternalFrameUI; |
import javax.swing.plaf.basic.BasicInternalFrameUI; |
46 |
|
|
47 |
|
/** |
48 |
|
* A UI delegate for the {@link JInternalFrame} component under the |
49 |
|
* {@link MetalLookAndFeel}. |
50 |
|
*/ |
51 |
public class MetalInternalFrameUI |
public class MetalInternalFrameUI |
52 |
extends BasicInternalFrameUI |
extends BasicInternalFrameUI |
53 |
{ |
{ |
54 |
|
|
|
/** The instances of MetalInternalFrameUI*/ |
|
|
private static HashMap instances; |
|
|
|
|
55 |
/** |
/** |
56 |
* Constructs a new instance of MetalInternalFrameUI. |
* Constructs a new instance of <code>MetalInternalFrameUI</code>. |
57 |
|
* |
58 |
|
* @param frame the frame. |
59 |
*/ |
*/ |
60 |
public MetalInternalFrameUI(JInternalFrame frame) |
public MetalInternalFrameUI(JInternalFrame frame) |
61 |
{ |
{ |
63 |
} |
} |
64 |
|
|
65 |
/** |
/** |
66 |
* Returns an instance of MetalInternalFrameUI. |
* Returns an instance of <code>MetalInternalFrameUI</code>. |
67 |
* |
* |
68 |
* @param component the component for which we return an UI instance |
* @param component the component for which we return an UI instance |
69 |
* |
* |
71 |
*/ |
*/ |
72 |
public static ComponentUI createUI(JComponent component) |
public static ComponentUI createUI(JComponent component) |
73 |
{ |
{ |
74 |
if (instances == null) |
return new MetalInternalFrameUI((JInternalFrame) component); |
|
instances = new HashMap(); |
|
|
|
|
|
|
|
|
Object o = instances.get(component); |
|
|
MetalInternalFrameUI instance; |
|
|
if (o == null) |
|
|
{ |
|
|
instance = new MetalInternalFrameUI((JInternalFrame) component); |
|
|
instances.put(component, instance); |
|
|
} |
|
|
else |
|
|
instance = (MetalInternalFrameUI) o; |
|
|
|
|
|
return instance; |
|
75 |
} |
} |
76 |
|
|
77 |
|
/** |
78 |
|
* Creates and returns the component that will be used for the north pane |
79 |
|
* of the {@link JInternalFrame}. |
80 |
|
* |
81 |
|
* @param w the internal frame. |
82 |
|
* |
83 |
|
* @return A new instance of {@link MetalInternalFrameTitlePane}. |
84 |
|
*/ |
85 |
protected JComponent createNorthPane(JInternalFrame w) |
protected JComponent createNorthPane(JInternalFrame w) |
86 |
{ |
{ |
87 |
titlePane = new MetalInternalFrameTitlePane(w); |
titlePane = new MetalInternalFrameTitlePane(w); |