< prev index next >
src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java
Print this page
@@ -54,10 +54,12 @@
// This is only used for its system menu, but we need a reference to it so
// we can remove its listeners.
private MotifInternalFrameTitlePane sysMenuTitlePane;
+ private TextUIDrawing textUIDrawing;
+
JPopupMenu systemMenu;
EventListener mml;
static final int LABEL_HEIGHT = 18;
static final int LABEL_DIVIDER = 4; // padding between icon and label
@@ -88,10 +90,11 @@
iconLabel.setBorder(border);
desktopIcon.add(iconLabel, BorderLayout.SOUTH);
desktopIcon.setSize(desktopIcon.getPreferredSize());
desktopIcon.validate();
JLayeredPane.putLayer(desktopIcon, JLayeredPane.getLayer(frame));
+ textUIDrawing = SwingUtilities2.getTextUIDrawing(textUIDrawing);
}
protected void installComponents(){
}
@@ -150,10 +153,14 @@
protected void uninstallDefaults(){
super.uninstallDefaults();
desktopIcon.setLayout(null);
desktopIcon.remove(iconButton);
desktopIcon.remove(iconLabel);
+ if (textUIDrawing != SwingUtilities2.DEFAULT_UI_TEXT_DRAWING
+ && textUIDrawing instanceof UIResource) {
+ textUIDrawing = SwingUtilities2.DEFAULT_UI_TEXT_DRAWING;
+ }
}
protected void uninstallListeners(){
super.uninstallListeners();
iconButton.removeActionListener(desktopIconActionListener);
@@ -258,11 +265,11 @@
public Dimension getPreferredSize() {
String title = frame.getTitle();
FontMetrics fm = frame.getFontMetrics(defaultTitleFont);
int w = 4;
if (title != null) {
- w += SwingUtilities2.stringWidth(frame, fm, title);
+ w += textUIDrawing.getStringWidth(frame, fm, title);
}
return new Dimension(w, LABEL_HEIGHT + LABEL_DIVIDER);
}
public void paint(Graphics g) {
@@ -286,11 +293,11 @@
int y = LABEL_HEIGHT - SwingUtilities2.getFontMetrics(frame, g).
getDescent();
g.setColor(UIManager.getColor("inactiveCaptionText"));
String title = frame.getTitle();
if (title != null) {
- SwingUtilities2.drawString(frame, g, title, 4, y);
+ textUIDrawing.drawString(frame, g, title, 4, y);
}
}
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
< prev index next >