< prev index next >

src/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java

Print this page
rev 1581 : 6693507: There are unnecessary compilation warnings in the com.sun.java.swing.plaf.motif package
Summary: Removed unnecessary castings and other warnings
Reviewed-by: peterz
Contributed-by: Florian Brunner <fbrunnerlist@gmx.ch>


 208                                      textRect, acceleratorRect,
 209                                      checkRect, arrowRect,
 210                                      b.getText() == null
 211                                      ? 0 : defaultTextIconGap,
 212                                      defaultTextIconGap
 213                                      );
 214 
 215         // Paint the Check
 216         Color holdc = g.getColor();
 217         if (checkIcon != null) {
 218             if(model.isArmed() || (c instanceof JMenu && model.isSelected()))
 219                 g.setColor(foreground);
 220             checkIcon.paintIcon(c, g, checkRect.x, checkRect.y);
 221             g.setColor(holdc);
 222         }
 223 
 224         // Paint the Icon
 225         if(b.getIcon() != null) {
 226             Icon icon;
 227             if(!model.isEnabled()) {
 228                 icon = (Icon) b.getDisabledIcon();
 229             } else if(model.isPressed() && model.isArmed()) {
 230                 icon = (Icon) b.getPressedIcon();
 231                 if(icon == null) {
 232                     // Use default icon
 233                     icon = (Icon) b.getIcon();
 234                 }
 235             } else {
 236                 icon = (Icon) b.getIcon();
 237             }
 238 
 239             if (icon!=null) {
 240                 icon.paintIcon(c, g, iconRect.x, iconRect.y);
 241             }
 242         }
 243 
 244         // Draw the Text
 245         if(text != null && !text.equals("")) {
 246             // Once BasicHTML becomes public, use BasicHTML.propertyKey
 247             // instead of the hardcoded string below!
 248             View v = (View) c.getClientProperty("html");
 249             if (v != null) {
 250                 v.paint(g, textRect);
 251             } else {
 252                 int mnemIndex = b.getDisplayedMnemonicIndex();
 253 
 254                 if(!model.isEnabled()) {
 255                     // *** paint the text disabled
 256                     g.setColor(b.getBackground().brighter());




 208                                      textRect, acceleratorRect,
 209                                      checkRect, arrowRect,
 210                                      b.getText() == null
 211                                      ? 0 : defaultTextIconGap,
 212                                      defaultTextIconGap
 213                                      );
 214 
 215         // Paint the Check
 216         Color holdc = g.getColor();
 217         if (checkIcon != null) {
 218             if(model.isArmed() || (c instanceof JMenu && model.isSelected()))
 219                 g.setColor(foreground);
 220             checkIcon.paintIcon(c, g, checkRect.x, checkRect.y);
 221             g.setColor(holdc);
 222         }
 223 
 224         // Paint the Icon
 225         if(b.getIcon() != null) {
 226             Icon icon;
 227             if(!model.isEnabled()) {
 228                 icon = b.getDisabledIcon();
 229             } else if(model.isPressed() && model.isArmed()) {
 230                 icon = b.getPressedIcon();
 231                 if(icon == null) {
 232                     // Use default icon
 233                     icon = b.getIcon();
 234                 }
 235             } else {
 236                 icon = b.getIcon();
 237             }
 238 
 239             if (icon!=null) {
 240                 icon.paintIcon(c, g, iconRect.x, iconRect.y);
 241             }
 242         }
 243 
 244         // Draw the Text
 245         if(text != null && !text.equals("")) {
 246             // Once BasicHTML becomes public, use BasicHTML.propertyKey
 247             // instead of the hardcoded string below!
 248             View v = (View) c.getClientProperty("html");
 249             if (v != null) {
 250                 v.paint(g, textRect);
 251             } else {
 252                 int mnemIndex = b.getDisplayedMnemonicIndex();
 253 
 254                 if(!model.isEnabled()) {
 255                     // *** paint the text disabled
 256                     g.setColor(b.getBackground().brighter());


< prev index next >