/[classpath]/classpath/javax/swing/plaf/metal/MetalIconFactory.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/metal/MetalIconFactory.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by trebligd, Sat Sep 10 21:06:24 2005 UTC revision 1.13 by trebligd, Mon Sep 12 15:42:35 2005 UTC
# Line 1076  public class MetalIconFactory implements Line 1076  public class MetalIconFactory implements
1076      /**      /**
1077       * Paints the icon.       * Paints the icon.
1078       *       *
1079       * @param c  the component.       * @param c  the component (an {@link JInternalFrame} is expected).
1080       * @param g  the graphics device.       * @param g  the graphics device.
1081       * @param x  the x-coordinate.       * @param x  the x-coordinate.
1082       * @param y  the y-coordinate.       * @param y  the y-coordinate.
1083       */       */
1084      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
1085      {      {
1086        // draw the gray areas first        Color savedColor = g.getColor();
1087        g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());        AbstractButton b = (AbstractButton) c;
1088          
1089          // fill the interior
1090          if (b.getModel().isPressed())
1091            // FIXME: also need to take into account whether the internal frame is
1092            // selected
1093            g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1094          else
1095            g.setColor(MetalLookAndFeel.getPrimaryControl());
1096          g.fillRect(x + 2, y + 2, 10, 10);
1097          
1098          // draw the outline box and the cross
1099          if (b.getModel().isPressed())
1100            g.setColor(MetalLookAndFeel.getBlack());
1101          else
1102            {
1103              // FIXME: also need to take into account whether the internal frame is
1104              // selected
1105              boolean selected = true;
1106              if (selected)
1107                g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1108              else
1109                g.setColor(MetalLookAndFeel.getControlDarkShadow());
1110            }
1111        g.drawLine(x + 1, y + 1, x + 13, y + 1);        g.drawLine(x + 1, y + 1, x + 13, y + 1);
1112        g.drawLine(x + 1, y + 2, x + 1, y + 12);        g.drawLine(x + 1, y + 2, x + 1, y + 12);
1113        g.drawLine(x + 1, y + 13, x + 13, y + 13);        g.drawLine(x + 1, y + 13, x + 13, y + 13);
1114        g.drawLine(x + 13, y + 2, x + 13, y + 12);        g.drawLine(x + 13, y + 2, x + 13, y + 12);
1115          g.drawLine(x + 2, y + 12, x + 2, y + 12);
1116          g.drawLine(x + 12, y + 2, x + 12, y + 2);
1117                
1118        g.fillRect(x + 4, y + 4, 2, 2);        g.fillRect(x + 4, y + 4, 2, 2);
1119        g.fillRect(x + 4, y + 9, 2, 2);        g.fillRect(x + 5, y + 5, 4, 4);
1120        g.fillRect(x + 9, y + 4, 2, 2);        g.drawLine(x + 9, y + 4, x + 10, y + 4);
1121        g.fillRect(x + 9, y + 9, 2, 2);        g.drawLine(x + 9, y + 4, x + 9, y + 5);
1122        g.fillRect(x + 5, y + 5, 5, 5);        g.drawLine(x + 4, y + 9, x + 4, y + 10);
1123          g.drawLine(x + 4, y + 9, x + 5, y + 9);
1124          g.drawLine(x + 9, y + 8, x + 9, y + 10);
1125          g.drawLine(x + 8, y + 9, x + 10, y + 9);
1126                
1127        g.setColor(MetalLookAndFeel.getBlack());        g.setColor(MetalLookAndFeel.getBlack());
1128        g.drawLine(x, y, x + 13, y);        g.drawLine(x, y, x + 13, y);
# Line 1110  public class MetalIconFactory implements Line 1138  public class MetalIconFactory implements
1138        g.drawLine(x + 1, y + 14, x + 14, y + 14);        g.drawLine(x + 1, y + 14, x + 14, y + 14);
1139        g.drawLine(x + 14, y + 1, x + 14, y + 14);        g.drawLine(x + 14, y + 1, x + 14, y + 14);
1140                
1141        g.drawLine(x + 5, y + 10, x + 5, y + 10);        if (!b.getModel().isPressed())
1142        g.drawLine(x + 6, y + 9, x + 7, y + 9);          {
1143        g.drawLine(x + 10, y + 5, x + 10, y + 5);            g.drawLine(x + 5, y + 10, x + 5, y + 10);
1144        g.drawLine(x + 9, y + 6, x + 9, y + 7);            g.drawLine(x + 6, y + 9, x + 7, y + 9);
1145        g.drawLine(x + 10, y + 10, x + 11, y + 10);            g.drawLine(x + 10, y + 5, x + 10, y + 5);
1146        g.drawLine(x + 10, y + 11, x + 10, y + 11);            g.drawLine(x + 9, y + 6, x + 9, y + 7);
1147              g.drawLine(x + 10, y + 10, x + 11, y + 10);
1148              g.drawLine(x + 10, y + 11, x + 10, y + 11);
1149            }
1150          g.setColor(savedColor);
1151      }              }        
1152    }    }
1153    
# Line 1239  public class MetalIconFactory implements Line 1271  public class MetalIconFactory implements
1271       */       */
1272      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
1273      {      {
1274        Color color = MetalLookAndFeel.getControlDarkShadow();        Color savedColor = g.getColor();
1275        if (c instanceof JInternalFrame)  
1276          {        AbstractButton b = (AbstractButton) c;
1277            JInternalFrame f = (JInternalFrame) c;  
1278            if (f.isSelected())        // fill the small box interior
1279              color = MetalLookAndFeel.getPrimaryControlShadow();        if (b.getModel().isPressed())
1280          }          g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1281        g.setColor(color);        else
1282            g.setColor(MetalLookAndFeel.getPrimaryControl());
1283          g.fillRect(x + 2, y + 6, 7, 7);
1284          
1285          
1286          if (b.getModel().isPressed())
1287            g.setColor(MetalLookAndFeel.getBlack());
1288          else
1289            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1290            
1291        g.drawLine(x + 12, y + 1, x + 13, y + 1);        g.drawLine(x + 12, y + 1, x + 13, y + 1);
1292        g.drawLine(x + 11, y + 2, x + 12, y + 2);        g.drawLine(x + 11, y + 2, x + 12, y + 2);
1293        g.drawLine(x + 10, y + 3, x + 11, y + 3);        g.drawLine(x + 10, y + 3, x + 11, y + 3);
# Line 1278  public class MetalIconFactory implements Line 1319  public class MetalIconFactory implements
1319        g.drawLine(x + 13, y + 6, x + 13, y + 6);        g.drawLine(x + 13, y + 6, x + 13, y + 6);
1320        g.drawLine(x + 8, y + 7, x + 13, y + 7);        g.drawLine(x + 8, y + 7, x + 13, y + 7);
1321        g.drawLine(x + 6, y + 5, x + 6, y + 5);        g.drawLine(x + 6, y + 5, x + 6, y + 5);
       g.drawLine(x + 2, y + 6, x + 6, y + 6);  
       g.drawLine(x + 2, y + 6, x + 2, y + 11);  
1322        g.drawLine(x + 10, y + 8, x + 10, y + 13);        g.drawLine(x + 10, y + 8, x + 10, y + 13);
1323        g.drawLine(x + 1, y + 14, x + 10, y + 14);        g.drawLine(x + 1, y + 14, x + 10, y + 14);
1324          
1325          if (!b.getModel().isPressed())
1326            {
1327              g.drawLine(x + 2, y + 6, x + 6, y + 6);
1328              g.drawLine(x + 2, y + 6, x + 2, y + 11);
1329            }
1330          
1331          g.setColor(savedColor);
1332      }              }        
1333    }    }
1334        
# Line 1330  public class MetalIconFactory implements Line 1377  public class MetalIconFactory implements
1377       */       */
1378      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
1379      {      {
1380        Color color = MetalLookAndFeel.getControlDarkShadow();        Color savedColor = g.getColor();
1381        if (c instanceof JInternalFrame)        
1382          {        AbstractButton b = (AbstractButton) c;
1383            JInternalFrame f = (JInternalFrame) c;        
1384            if (f.isSelected())        // fill the interior
1385              color = MetalLookAndFeel.getPrimaryControlShadow();        if (b.getModel().isPressed())
1386          }          g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1387        g.setColor(color);        else
1388            g.setColor(MetalLookAndFeel.getPrimaryControl());
1389          g.fillRect(x + 2, y + 6, 7, 7);
1390    
1391          if (b.getModel().isPressed())
1392            g.setColor(MetalLookAndFeel.getBlack());
1393          else
1394            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1395              
1396        g.drawLine(x + 9, y + 1, x + 10, y + 1);        g.drawLine(x + 9, y + 1, x + 10, y + 1);
1397        g.fillRect(x + 11, y + 1, 3, 3);        g.fillRect(x + 11, y + 1, 3, 3);
1398        g.fillRect(x + 12, y + 4, 2, 2);        g.fillRect(x + 12, y + 4, 2, 2);
# Line 1372  public class MetalIconFactory implements Line 1427  public class MetalIconFactory implements
1427                
1428        // draw white        // draw white
1429        g.setColor(MetalLookAndFeel.getWhite());        g.setColor(MetalLookAndFeel.getWhite());
1430        g.drawLine(x + 2, y + 6, x + 5, y + 6);        if (!b.getModel().isPressed())
1431        g.drawLine(x + 2, y + 7, x + 2, y + 9);          {
1432        g.drawLine(x + 4, y + 11, x + 7, y + 8);            g.drawLine(x + 2, y + 6, x + 5, y + 6);
1433              g.drawLine(x + 2, y + 7, x + 2, y + 9);
1434              g.drawLine(x + 4, y + 11, x + 7, y + 8);
1435            }
1436                
1437        g.drawLine(x + 1, y + 14, x + 10, y + 14);        g.drawLine(x + 1, y + 14, x + 10, y + 14);
1438        g.drawLine(x + 10, y + 5, x + 10, y + 13);        g.drawLine(x + 10, y + 5, x + 10, y + 13);
# Line 1383  public class MetalIconFactory implements Line 1441  public class MetalIconFactory implements
1441        g.drawLine(x + 11, y + 4, x + 11, y + 5);        g.drawLine(x + 11, y + 4, x + 11, y + 5);
1442        g.drawLine(x + 13, y + 6, x + 14, y + 6);        g.drawLine(x + 13, y + 6, x + 14, y + 6);
1443        g.drawLine(x + 14, y + 1, x + 14, y + 5);        g.drawLine(x + 14, y + 1, x + 14, y + 5);
1444          g.setColor(savedColor);
1445      }              }        
1446    }    }
1447    
# Line 1430  public class MetalIconFactory implements Line 1489  public class MetalIconFactory implements
1489       */       */
1490      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
1491      {      {
1492        Color color = MetalLookAndFeel.getControlDarkShadow();        Color savedColor = g.getColor();
1493        if (c instanceof JInternalFrame)        
1494          {        AbstractButton b = (AbstractButton) c;
1495            JInternalFrame f = (JInternalFrame) c;        
1496            if (f.isSelected())        if (b.getModel().isPressed())
1497              color = MetalLookAndFeel.getPrimaryControlShadow();          g.setColor(MetalLookAndFeel.getBlack());
1498          }        else
1499        g.setColor(color);          // FIXME: here the color depends on whether or not the internal frame
1500            // is selected
1501            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1502          
1503        g.drawLine(x + 12, y + 1, x + 13, y + 1);        g.drawLine(x + 12, y + 1, x + 13, y + 1);
1504        g.drawLine(x + 11, y + 2, x + 12, y + 2);        g.drawLine(x + 11, y + 2, x + 12, y + 2);
1505        g.drawLine(x + 10, y + 3, x + 11, y + 3);        g.drawLine(x + 10, y + 3, x + 11, y + 3);
# Line 1468  public class MetalIconFactory implements Line 1530  public class MetalIconFactory implements
1530        g.drawLine(x + 11, y + 4, x + 13, y + 2);        g.drawLine(x + 11, y + 4, x + 13, y + 2);
1531        g.drawLine(x + 13, y + 6, x + 13, y + 6);        g.drawLine(x + 13, y + 6, x + 13, y + 6);
1532        g.drawLine(x + 8, y + 7, x + 13, y + 7);        g.drawLine(x + 8, y + 7, x + 13, y + 7);
       g.drawLine(x + 2, y + 9, x + 4, y + 9);  
       g.drawLine(x + 2, y + 10, x + 2, y + 11);  
1533        g.drawLine(x + 7, y + 9, x + 7, y + 13);        g.drawLine(x + 7, y + 9, x + 7, y + 13);
1534        g.drawLine(x + 1, y + 14, x + 7, y + 14);        g.drawLine(x + 1, y + 14, x + 7, y + 14);
1535    
1536          if (b.getModel().isPressed())
1537            {
1538              g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1539              g.fillRect(x + 2, y + 9, 3, 3);
1540            }
1541          else
1542            {
1543              g.drawLine(x + 2, y + 9, x + 4, y + 9);
1544              g.drawLine(x + 2, y + 10, x + 2, y + 11);
1545            }
1546    
1547          g.setColor(savedColor);
1548      }              }        
1549    }    }
1550    
# Line 1875  public class MetalIconFactory implements Line 1948  public class MetalIconFactory implements
1948    {    {
1949      return new FileChooserUpFolderIcon();      return new FileChooserUpFolderIcon();
1950    }    }
1951    
1952    /**    /**
1953     * Returns an icon for RadioButtons in the Metal L&F.     * Returns an icon for RadioButtons in the Metal L&F.
1954     *     *

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26