< prev index next >
src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifPopupMenuUI.java
Print this page
@@ -60,15 +60,31 @@
* @author Rich Schiavi
*/
public class MotifPopupMenuUI extends BasicPopupMenuUI {
private static Border border = null;
private Font titleFont = null;
+ private TextUIDrawing textUIDrawing;
public static ComponentUI createUI(JComponent x) {
return new MotifPopupMenuUI();
}
+ @Override
+ public void installDefaults() {
+ super.installDefaults();
+ textUIDrawing = SwingUtilities2.getTextUIDrawing(textUIDrawing);
+ }
+
+ @Override
+ protected void uninstallDefaults() {
+ super.uninstallDefaults();
+ if (textUIDrawing != SwingUtilities2.DEFAULT_UI_TEXT_DRAWING
+ && textUIDrawing instanceof UIResource) {
+ textUIDrawing = SwingUtilities2.DEFAULT_UI_TEXT_DRAWING;
+ }
+ }
+
/* This has to deal with the fact that the title may be wider than
the widest child component.
*/
public Dimension getPreferredSize(JComponent c) {
LayoutManager layout = c.getLayout();
@@ -80,11 +96,11 @@
}
FontMetrics fm = c.getFontMetrics(titleFont);
int stringWidth = 0;
if (title!=null) {
- stringWidth += SwingUtilities2.stringWidth(c, fm, title);
+ stringWidth += textUIDrawing.getStringWidth(c, fm, title);
}
if (d.width < stringWidth) {
d.width = stringWidth + 8;
Insets i = c.getInsets();
< prev index next >