< prev index next >
src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java
Print this page
*** 54,63 ****
--- 54,65 ----
// 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,97 ****
--- 90,100 ----
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,159 ****
--- 153,166 ----
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,268 ****
public Dimension getPreferredSize() {
String title = frame.getTitle();
FontMetrics fm = frame.getFontMetrics(defaultTitleFont);
int w = 4;
if (title != null) {
! w += SwingUtilities2.stringWidth(frame, fm, title);
}
return new Dimension(w, LABEL_HEIGHT + LABEL_DIVIDER);
}
public void paint(Graphics g) {
--- 265,275 ----
public Dimension getPreferredSize() {
String title = frame.getTitle();
FontMetrics fm = frame.getFontMetrics(defaultTitleFont);
int w = 4;
if (title != null) {
! w += textUIDrawing.getStringWidth(frame, fm, title);
}
return new Dimension(w, LABEL_HEIGHT + LABEL_DIVIDER);
}
public void paint(Graphics g) {
*** 286,296 ****
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);
}
}
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
--- 293,303 ----
int y = LABEL_HEIGHT - SwingUtilities2.getFontMetrics(frame, g).
getDescent();
g.setColor(UIManager.getColor("inactiveCaptionText"));
String title = frame.getTitle();
if (title != null) {
! textUIDrawing.drawString(frame, g, title, 4, y);
}
}
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
< prev index next >