< prev index next >

src/java.desktop/share/classes/sun/swing/MenuItemLayoutHelper.java

Print this page




 239 
 240     private int getCheckOffset(String propertyPrefix) {
 241         int checkIconOffset = gap;
 242         Object checkIconOffsetObject =
 243                 UIManager.get(propertyPrefix + ".checkIconOffset");
 244         if (checkIconOffsetObject instanceof Integer) {
 245             checkIconOffset = (Integer) checkIconOffsetObject;
 246         }
 247         return checkIconOffset;
 248     }
 249 
 250     protected void calcWidthsAndHeights() {
 251         // iconRect
 252         if (icon != null) {
 253             iconSize.width = icon.getIconWidth();
 254             iconSize.height = icon.getIconHeight();
 255         }
 256 
 257         // accRect
 258         if (!accText.equals("")) {
 259             accSize.width = SwingUtilities2.stringWidth(mi, accFm, accText);

 260             accSize.height = accFm.getHeight();
 261         }
 262 
 263         // textRect
 264         if (text == null) {
 265             text = "";
 266         } else if (!text.equals("")) {
 267             if (htmlView != null) {
 268                 // Text is HTML
 269                 textSize.width =
 270                         (int) htmlView.getPreferredSpan(View.X_AXIS);
 271                 textSize.height =
 272                         (int) htmlView.getPreferredSpan(View.Y_AXIS);
 273             } else {
 274                 // Text isn't HTML
 275                 textSize.width = SwingUtilities2.stringWidth(mi, fm, text);

 276                 textSize.height = fm.getHeight();
 277             }
 278         }
 279 
 280         if (useCheckAndArrow) {
 281             // checkIcon
 282             if (checkIcon != null) {
 283                 checkSize.width = checkIcon.getIconWidth();
 284                 checkSize.height = checkIcon.getIconHeight();
 285             }
 286             // arrowRect
 287             if (arrowIcon != null) {
 288                 arrowSize.width = arrowIcon.getIconWidth();
 289                 arrowSize.height = arrowIcon.getIconHeight();
 290             }
 291         }
 292 
 293         // labelRect
 294         if (isColumnLayout) {
 295             labelSize.width = iconSize.width + textSize.width + gap;




 239 
 240     private int getCheckOffset(String propertyPrefix) {
 241         int checkIconOffset = gap;
 242         Object checkIconOffsetObject =
 243                 UIManager.get(propertyPrefix + ".checkIconOffset");
 244         if (checkIconOffsetObject instanceof Integer) {
 245             checkIconOffset = (Integer) checkIconOffsetObject;
 246         }
 247         return checkIconOffset;
 248     }
 249 
 250     protected void calcWidthsAndHeights() {
 251         // iconRect
 252         if (icon != null) {
 253             iconSize.width = icon.getIconWidth();
 254             iconSize.height = icon.getIconHeight();
 255         }
 256 
 257         // accRect
 258         if (!accText.equals("")) {
 259             accSize.width = SwingUtilities2.getTextUIDrawing(mi)
 260                     .getStringWidth(mi, accFm, accText);
 261             accSize.height = accFm.getHeight();
 262         }
 263 
 264         // textRect
 265         if (text == null) {
 266             text = "";
 267         } else if (!text.equals("")) {
 268             if (htmlView != null) {
 269                 // Text is HTML
 270                 textSize.width =
 271                         (int) htmlView.getPreferredSpan(View.X_AXIS);
 272                 textSize.height =
 273                         (int) htmlView.getPreferredSpan(View.Y_AXIS);
 274             } else {
 275                 // Text isn't HTML
 276                 textSize.width = SwingUtilities2.getTextUIDrawing(mi)
 277                         .getStringWidth(mi, fm, text);
 278                 textSize.height = fm.getHeight();
 279             }
 280         }
 281 
 282         if (useCheckAndArrow) {
 283             // checkIcon
 284             if (checkIcon != null) {
 285                 checkSize.width = checkIcon.getIconWidth();
 286                 checkSize.height = checkIcon.getIconHeight();
 287             }
 288             // arrowRect
 289             if (arrowIcon != null) {
 290                 arrowSize.width = arrowIcon.getIconWidth();
 291                 arrowSize.height = arrowIcon.getIconHeight();
 292             }
 293         }
 294 
 295         // labelRect
 296         if (isColumnLayout) {
 297             labelSize.width = iconSize.width + textSize.width + gap;


< prev index next >