/[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.4.2.2 by gnu_andrew, Sat Sep 10 15:31:52 2005 UTC revision 1.4.2.3 by gnu_andrew, Tue Sep 20 18:46:34 2005 UTC
# Line 43  import java.awt.Component; Line 43  import java.awt.Component;
43  import java.awt.Graphics;  import java.awt.Graphics;
44  import java.io.Serializable;  import java.io.Serializable;
45    
46    import javax.swing.AbstractButton;
47  import javax.swing.Icon;  import javax.swing.Icon;
48  import javax.swing.JCheckBox;  import javax.swing.JCheckBox;
49  import javax.swing.JCheckBoxMenuItem;  import javax.swing.JCheckBoxMenuItem;
50    import javax.swing.JFileChooser;
51  import javax.swing.JInternalFrame;  import javax.swing.JInternalFrame;
52  import javax.swing.JRadioButton;  import javax.swing.JRadioButton;
53  import javax.swing.JRadioButtonMenuItem;  import javax.swing.JRadioButtonMenuItem;
# Line 137  public class MetalIconFactory implements Line 139  public class MetalIconFactory implements
139    }    }
140    
141    /**    /**
142       * An icon used for the "detail view" button on a {@link JFileChooser} under
143       * the {@link MetalLookAndFeel}.
144       *
145       * @see MetalIconFactory#getFileChooserDetailViewIcon()
146       */
147      private static class FileChooserDetailViewIcon
148          implements Icon, Serializable {
149        
150        /**
151         * Creates a new icon.
152         */
153        public FileChooserDetailViewIcon()
154        {
155        }
156          
157        /**
158         * Returns the width of the icon, in pixels.
159         *
160         * @return The width of the icon.
161         */
162        public int getIconWidth()
163        {
164          return 18;
165        }
166        
167        /**
168         * Returns the height of the icon, in pixels.
169         *
170         * @return The height of the icon.
171         */
172        public int getIconHeight()
173        {
174          return 18;
175        }
176        
177        /**
178         * Paints the icon using colors from the {@link MetalLookAndFeel}.
179         *
180         * @param c  the component (ignored).
181         * @param g  the graphics device.
182         * @param x  the x-coordinate for the top-left of the icon.
183         * @param y  the y-coordinate for the top-left of the icon.
184         */
185        public void paintIcon(Component c, Graphics g, int x, int y)
186        {
187          Color savedColor = g.getColor();
188          g.setColor(MetalLookAndFeel.getBlack());
189    
190          // file 1 outline
191          g.drawLine(x + 2, y + 2, x + 5, y + 2);
192          g.drawLine(x + 6, y + 3, x + 6, y + 7);
193          g.drawLine(x + 2, y + 7, x + 6, y + 7);
194          g.drawLine(x + 2, y + 2, x + 2, y + 7);
195          
196          // file 2 outline
197          g.drawLine(x + 2, y + 10, x + 5, y + 10);
198          g.drawLine(x + 6, y + 11, x + 6, y + 15);
199          g.drawLine(x + 2, y + 15, x + 6, y + 15);
200          g.drawLine(x + 2, y + 10, x + 2, y + 15);
201    
202          // detail lines
203          g.drawLine(x + 8, y + 5, x + 15, y + 5);
204          g.drawLine(x + 8, y + 13, x + 15, y + 13);
205          
206          // fill files
207          g.setColor(MetalLookAndFeel.getPrimaryControl());
208          g.fillRect(x + 3, y + 3, 3, 4);
209          g.fillRect(x + 3, y + 11, 3, 4);
210          
211          // highlight files
212          g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
213          g.drawLine(x + 4, y + 4, x + 4, y + 5);
214          g.drawLine(x + 4, y + 12, x + 4, y + 13);
215          
216          g.setColor(savedColor);
217        }        
218      }
219    
220      /**
221       * An icon used for the "home folder" button on a {@link JFileChooser} under
222       * the {@link MetalLookAndFeel}.
223       *
224       * @see MetalIconFactory#getFileChooserHomeFolderIcon()
225       */
226      private static class FileChooserHomeFolderIcon
227          implements Icon, Serializable {
228            
229        /**
230         * Creates a new icon.
231         */
232        public FileChooserHomeFolderIcon()
233        {
234        }
235    
236        /**
237         * Returns the width of the icon, in pixels.
238         *
239         * @return The width of the icon.
240         */
241        public int getIconWidth()
242        {
243          return 18;
244        }
245        
246        /**
247         * Returns the height of the icon, in pixels.
248         *
249         * @return The height of the icon.
250         */
251        public int getIconHeight()
252        {
253          return 18;
254        }
255        
256        /**
257         * Paints the icon using colors from the {@link MetalLookAndFeel}.
258         *
259         * @param c  the component (ignored).
260         * @param g  the graphics device.
261         * @param x  the x-coordinate for the top-left of the icon.
262         * @param y  the y-coordinate for the top-left of the icon.
263         */
264        public void paintIcon(Component c, Graphics g, int x, int y)
265        {  
266          Color savedColor = g.getColor();
267          g.setColor(MetalLookAndFeel.getBlack());
268          
269          // roof
270          g.drawLine(x + 1, y + 8, x + 8, y + 1);
271          g.drawLine(x + 8, y + 1, x + 15, y + 8);
272          
273          // base of house
274          g.drawLine(x + 3, y + 6, x + 3, y + 15);
275          g.drawLine(x + 3, y + 15, x + 13, y + 15);
276          g.drawLine(x + 13, y + 6, x + 13, y + 15);
277          
278          // door frame
279          g.drawLine(x + 6, y + 9, x + 6, y + 15);
280          g.drawLine(x + 6, y + 9, x + 10, y + 9);
281          g.drawLine(x + 10, y + 9, x + 10, y + 15);
282          
283          // chimney
284          g.drawLine(x + 11, y + 2, x + 11, y + 4);
285          g.drawLine(x + 12, y + 2, x + 12, y + 5);
286          
287          g.setColor(MetalLookAndFeel.getControlDarkShadow());
288          
289          // roof paint
290          int xx = x + 8;
291          for (int i = 0; i < 4; i++)
292            g.drawLine(xx - i, y + 2 + i, xx + i, y + 2 + i);
293          g.fillRect(x + 4, y + 6, 9, 2);
294          
295          // door knob
296          g.drawLine(x + 9, y + 12, x + 9, y + 12);
297          
298          // house paint
299          g.setColor(MetalLookAndFeel.getPrimaryControl());
300          g.drawLine(x + 4, y + 8, x + 12, y + 8);
301          g.fillRect(x + 4, y + 9, 2, 6);
302          g.fillRect(x + 11, y + 9, 2, 6);
303          
304          g.setColor(savedColor);
305        }        
306      }
307        
308      /**
309       * An icon used for the "list view" button on a {@link JFileChooser} under
310       * the {@link MetalLookAndFeel}.
311       *
312       * @see MetalIconFactory#getFileChooserListViewIcon()
313       */
314      private static class FileChooserListViewIcon implements Icon, Serializable
315      {
316        /**
317         * Creates a new icon.
318         */
319        public FileChooserListViewIcon()
320        {
321        }
322        
323        /**
324         * Returns the width of the icon, in pixels.
325         *
326         * @return The width of the icon.
327         */
328        public int getIconWidth()
329        {
330          return 18;
331        }
332        
333        /**
334         * Returns the height of the icon, in pixels.
335         *
336         * @return The height of the icon.
337         */
338        public int getIconHeight()
339        {
340          return 18;
341        }
342        
343        /**
344         * Paints the icon using colors from the {@link MetalLookAndFeel}.
345         *
346         * @param c  the component (ignored).
347         * @param g  the graphics device.
348         * @param x  the x-coordinate for the top-left of the icon.
349         * @param y  the y-coordinate for the top-left of the icon.
350         */
351        public void paintIcon(Component c, Graphics g, int x, int y)
352        {
353          Color savedColor = g.getColor();
354          g.setColor(MetalLookAndFeel.getBlack());
355    
356          // file 1 outline
357          g.drawLine(x + 2, y + 2, x + 5, y + 2);
358          g.drawLine(x + 6, y + 3, x + 6, y + 7);
359          g.drawLine(x + 2, y + 7, x + 6, y + 7);
360          g.drawLine(x + 2, y + 2, x + 2, y + 7);
361          
362          // file 2 outline
363          g.drawLine(x + 2, y + 10, x + 5, y + 10);
364          g.drawLine(x + 6, y + 11, x + 6, y + 15);
365          g.drawLine(x + 2, y + 15, x + 6, y + 15);
366          g.drawLine(x + 2, y + 10, x + 2, y + 15);
367          
368          // file 3 outline
369          g.drawLine(x + 10, y + 2, x + 13, y + 2);
370          g.drawLine(x + 14, y + 3, x + 14, y + 7);
371          g.drawLine(x + 10, y + 7, x + 14, y + 7);
372          g.drawLine(x + 10, y + 2, x + 10, y + 7);
373          
374          // file 4 outline
375          g.drawLine(x + 10, y + 10, x + 13, y + 10);
376          g.drawLine(x + 14, y + 11, x + 14, y + 15);
377          g.drawLine(x + 10, y + 15, x + 14, y + 15);
378          g.drawLine(x + 10, y + 10, x + 10, y + 15);
379          
380          g.drawLine(x + 8, y + 5, x + 8, y + 5);
381          g.drawLine(x + 8, y + 13, x + 8, y + 13);
382          g.drawLine(x + 16, y + 5, x + 16, y + 5);
383          g.drawLine(x + 16, y + 13, x + 16, y + 13);
384          
385          // fill files
386          g.setColor(MetalLookAndFeel.getPrimaryControl());
387          g.fillRect(x + 3, y + 3, 3, 4);
388          g.fillRect(x + 3, y + 11, 3, 4);
389          g.fillRect(x + 11, y + 3, 3, 4);
390          g.fillRect(x + 11, y + 11, 3, 4);
391          
392          // highlight files
393          g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
394          g.drawLine(x + 4, y + 4, x + 4, y + 5);
395          g.drawLine(x + 4, y + 12, x + 4, y + 13);
396          g.drawLine(x + 12, y + 4, x + 12, y + 5);
397          g.drawLine(x + 12, y + 12, x + 12, y + 13);
398    
399          g.setColor(savedColor);
400        }        
401      }
402        
403      /**
404       * An icon used for the "new folder" button on a {@link JFileChooser} under
405       * the {@link MetalLookAndFeel}.
406       *
407       * @see MetalIconFactory#getFileChooserNewFolderIcon()
408       */
409      private static class FileChooserNewFolderIcon
410          implements Icon, Serializable
411      {
412        /**
413         * Creates a new icon.
414         */
415        public FileChooserNewFolderIcon()
416        {
417        }
418        
419        /**
420         * Returns the width of the icon, in pixels.
421         *
422         * @return The width of the icon.
423         */
424        public int getIconWidth()
425        {
426          return 18;
427        }
428        
429        /**
430         * Returns the height of the icon, in pixels.
431         *
432         * @return The height of the icon.
433         */
434        public int getIconHeight()
435        {
436          return 18;
437        }
438        
439        /**
440         * Paints the icon using colors from the {@link MetalLookAndFeel}.
441         *
442         * @param c  the component (ignored).
443         * @param g  the graphics device.
444         * @param x  the x-coordinate for the top-left of the icon.
445         * @param y  the y-coordinate for the top-left of the icon.
446         */
447        public void paintIcon(Component c, Graphics g, int x, int y)
448        {      
449          Color savedColor = g.getColor();
450          g.setColor(MetalLookAndFeel.getBlack());
451          
452          g.drawLine(x + 2, y + 5, x + 9, y + 5);
453          g.drawLine(x + 10, y + 6, x + 15, y + 6);
454          g.drawLine(x + 15, y + 5, x + 15, y + 14);
455          g.drawLine(x + 2, y + 14, x + 15, y + 14);
456          g.drawLine(x + 1, y + 6, x + 1, y + 14);
457          
458          g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
459          g.drawLine(x + 11, y + 3, x + 15, y + 3);
460          g.drawLine(x + 10, y + 4, x + 15, y + 4);
461          
462          g.setColor(MetalLookAndFeel.getPrimaryControl());
463          g.fillRect(x + 3, y + 7, 7, 7);
464          g.fillRect(x + 10, y + 8, 5, 6);
465          g.drawLine(x + 10, y + 5, x + 14, y + 5);
466          
467          g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
468          g.drawLine(x + 10, y + 7, x + 14, y + 7);
469          g.drawLine(x + 2, y + 6, x + 9, y + 6);
470          g.drawLine(x + 2, y + 6, x + 2, y + 13);
471          g.setColor(savedColor);
472        }        
473      }
474    
475      /**
476       * An icon used for the "up folder" button on a {@link JFileChooser} under
477       * the {@link MetalLookAndFeel}.
478       *
479       * @see MetalIconFactory#getFileChooserNewFolderIcon()
480       */
481      private static class FileChooserUpFolderIcon
482        extends FileChooserNewFolderIcon
483        implements Icon, Serializable
484      {
485        /**
486         * Creates a new icon.
487         */
488        public FileChooserUpFolderIcon()
489        {
490        }
491        
492        /**
493         * Paints the icon using colors from the {@link MetalLookAndFeel}.
494         *
495         * @param c  the component (ignored).
496         * @param g  the graphics device.
497         * @param x  the x-coordinate for the top-left of the icon.
498         * @param y  the y-coordinate for the top-left of the icon.
499         */
500        public void paintIcon(Component c, Graphics g, int x, int y)
501        {
502          Color savedColor = g.getColor();
503    
504          // draw the folder
505          super.paintIcon(c, g, x, y);
506          
507          // now draw the up arrow
508          g.setColor(MetalLookAndFeel.getBlack());
509          g.drawLine(x + 8, y + 9, x + 8, y + 16);
510          int xx = x + 8;
511          for (int i = 0; i < 4; i++)
512            g.drawLine(xx - i, y + 9 + i, xx + i, y + 9 + i);
513          g.setColor(savedColor);
514        }        
515      }
516    
517      /**
518     * An icon representing a file (drawn as a piece of paper with the top-right     * An icon representing a file (drawn as a piece of paper with the top-right
519     * corner turned down).     * corner turned down).
520     */     */
# Line 285  public class MetalIconFactory implements Line 663  public class MetalIconFactory implements
663      }      }
664                    
665    }    }
666      
667      /**
668       * An icon used by the {@link MetalInternalFrameUI} class when the frame
669       * is displayed as a palette.
670       *
671       * @since 1.3
672       */
673      public static class PaletteCloseIcon
674        implements Icon, Serializable, UIResource
675      {
676        /**
677         * Returns the width of the icon, in pixels.
678         *
679         * @return The width of the icon.
680         */
681        public int getIconWidth()
682        {
683          return 7;
684        }
685        
686        /**
687         * Returns the height of the icon, in pixels.
688         *
689         * @return The height of the icon.
690         */
691        public int getIconHeight()
692        {
693          return 7;
694        }
695        
696        /**
697         * Paints the icon using colors from the {@link MetalLookAndFeel}.
698         *
699         * @param c  the component (ignored).
700         * @param g  the graphics device.
701         * @param x  the x-coordinate for the top-left of the icon.
702         * @param y  the y-coordinate for the top-left of the icon.
703         */
704        public void paintIcon(Component c, Graphics g, int x, int y)
705        {
706          Color savedColor = g.getColor();
707          AbstractButton button = (AbstractButton) c;
708          if (button.getModel().isPressed())
709            g.setColor(MetalLookAndFeel.getBlack());
710          else
711            g.setColor(MetalLookAndFeel.getControlDarkShadow());
712          g.fillRect(x + 2, y + 2, 3, 3);
713          g.drawLine(x + 1, y, x + 1, y + 2);
714          g.drawLine(x, y + 1, x + 2, y + 1);
715          g.drawLine(x + 5, y, x + 5, y + 2);
716          g.drawLine(x + 4, y + 1, x + 6, y + 1);
717          g.drawLine(x + 1, y + 4, x + 1, y + 6);
718          g.drawLine(x, y + 5, x + 2, y + 5);
719          g.drawLine(x + 5, y + 4, x + 5, y + 6);
720          g.drawLine(x + 4, y + 5, x + 6, y + 5);
721          g.setColor(MetalLookAndFeel.getControlHighlight());
722          g.drawLine(x + 2, y + 6, x + 3, y + 5);
723          g.drawLine(x + 5, y + 3, x + 6, y + 2);
724          g.drawLine(x + 6, y + 6, x + 6, y + 6);
725          g.setColor(savedColor);
726        }        
727      }
728      
729    /**    /**
730     * An {@link Icon} implementation for {@link JCheckBox}es in the     * An {@link Icon} implementation for {@link JCheckBox}es in the
731     * Metal Look &amp; Feel.     * Metal Look &amp; Feel.
# Line 392  public class MetalIconFactory implements Line 832  public class MetalIconFactory implements
832                
833        if (b.isSelected())        if (b.isSelected())
834          {          {
835            g.setColor(MetalLookAndFeel.getBlack());            if (b.isEnabled())
836                g.setColor(MetalLookAndFeel.getBlack());
837              else
838                g.setColor(MetalLookAndFeel.getControlDisabled());
839            g.drawLine(x + 4, y + 3, x + 7, y + 3);            g.drawLine(x + 4, y + 3, x + 7, y + 3);
840            g.fillRect(x + 3, y + 4, 6, 4);            g.fillRect(x + 3, y + 4, 6, 4);
841            g.drawLine(x + 4, y + 8, x + 7, y + 8);            g.drawLine(x + 4, y + 8, x + 7, y + 8);
# Line 637  public class MetalIconFactory implements Line 1080  public class MetalIconFactory implements
1080      /**      /**
1081       * Paints the icon.       * Paints the icon.
1082       *       *
1083       * @param c  the component.       * @param c  the component (an {@link JInternalFrame} is expected).
1084       * @param g  the graphics device.       * @param g  the graphics device.
1085       * @param x  the x-coordinate.       * @param x  the x-coordinate.
1086       * @param y  the y-coordinate.       * @param y  the y-coordinate.
1087       */       */
1088      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
1089      {      {
1090        // draw the gray areas first        Color savedColor = g.getColor();
1091        g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());        AbstractButton b = (AbstractButton) c;
1092          
1093          // fill the interior
1094          if (b.getModel().isPressed())
1095            // FIXME: also need to take into account whether the internal frame is
1096            // selected
1097            g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1098          else
1099            g.setColor(MetalLookAndFeel.getPrimaryControl());
1100          g.fillRect(x + 2, y + 2, 10, 10);
1101          
1102          // draw the outline box and the cross
1103          if (b.getModel().isPressed())
1104            g.setColor(MetalLookAndFeel.getBlack());
1105          else
1106            {
1107              // FIXME: also need to take into account whether the internal frame is
1108              // selected
1109              boolean selected = true;
1110              if (selected)
1111                g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1112              else
1113                g.setColor(MetalLookAndFeel.getControlDarkShadow());
1114            }
1115        g.drawLine(x + 1, y + 1, x + 13, y + 1);        g.drawLine(x + 1, y + 1, x + 13, y + 1);
1116        g.drawLine(x + 1, y + 2, x + 1, y + 12);        g.drawLine(x + 1, y + 2, x + 1, y + 12);
1117        g.drawLine(x + 1, y + 13, x + 13, y + 13);        g.drawLine(x + 1, y + 13, x + 13, y + 13);
1118        g.drawLine(x + 13, y + 2, x + 13, y + 12);        g.drawLine(x + 13, y + 2, x + 13, y + 12);
1119          g.drawLine(x + 2, y + 12, x + 2, y + 12);
1120          g.drawLine(x + 12, y + 2, x + 12, y + 2);
1121                
1122        g.fillRect(x + 4, y + 4, 2, 2);        g.fillRect(x + 4, y + 4, 2, 2);
1123        g.fillRect(x + 4, y + 9, 2, 2);        g.fillRect(x + 5, y + 5, 4, 4);
1124        g.fillRect(x + 9, y + 4, 2, 2);        g.drawLine(x + 9, y + 4, x + 10, y + 4);
1125        g.fillRect(x + 9, y + 9, 2, 2);        g.drawLine(x + 9, y + 4, x + 9, y + 5);
1126        g.fillRect(x + 5, y + 5, 5, 5);        g.drawLine(x + 4, y + 9, x + 4, y + 10);
1127          g.drawLine(x + 4, y + 9, x + 5, y + 9);
1128          g.drawLine(x + 9, y + 8, x + 9, y + 10);
1129          g.drawLine(x + 8, y + 9, x + 10, y + 9);
1130                
1131        g.setColor(MetalLookAndFeel.getBlack());        g.setColor(MetalLookAndFeel.getBlack());
1132        g.drawLine(x, y, x + 13, y);        g.drawLine(x, y, x + 13, y);
# Line 671  public class MetalIconFactory implements Line 1142  public class MetalIconFactory implements
1142        g.drawLine(x + 1, y + 14, x + 14, y + 14);        g.drawLine(x + 1, y + 14, x + 14, y + 14);
1143        g.drawLine(x + 14, y + 1, x + 14, y + 14);        g.drawLine(x + 14, y + 1, x + 14, y + 14);
1144                
1145        g.drawLine(x + 5, y + 10, x + 5, y + 10);        if (!b.getModel().isPressed())
1146        g.drawLine(x + 6, y + 9, x + 7, y + 9);          {
1147        g.drawLine(x + 10, y + 5, x + 10, y + 5);            g.drawLine(x + 5, y + 10, x + 5, y + 10);
1148        g.drawLine(x + 9, y + 6, x + 9, y + 7);            g.drawLine(x + 6, y + 9, x + 7, y + 9);
1149        g.drawLine(x + 10, y + 10, x + 11, y + 10);            g.drawLine(x + 10, y + 5, x + 10, y + 5);
1150        g.drawLine(x + 10, y + 11, x + 10, y + 11);            g.drawLine(x + 9, y + 6, x + 9, y + 7);
1151              g.drawLine(x + 10, y + 10, x + 11, y + 10);
1152              g.drawLine(x + 10, y + 11, x + 10, y + 11);
1153            }
1154          g.setColor(savedColor);
1155      }              }        
1156    }    }
1157    
# Line 800  public class MetalIconFactory implements Line 1275  public class MetalIconFactory implements
1275       */       */
1276      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
1277      {      {
1278        Color color = MetalLookAndFeel.getControlDarkShadow();        Color savedColor = g.getColor();
1279        if (c instanceof JInternalFrame)  
1280          {        AbstractButton b = (AbstractButton) c;
1281            JInternalFrame f = (JInternalFrame) c;  
1282            if (f.isSelected())        // fill the small box interior
1283              color = MetalLookAndFeel.getPrimaryControlShadow();        if (b.getModel().isPressed())
1284          }          g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1285        g.setColor(color);        else
1286            g.setColor(MetalLookAndFeel.getPrimaryControl());
1287          g.fillRect(x + 2, y + 6, 7, 7);
1288          
1289          
1290          if (b.getModel().isPressed())
1291            g.setColor(MetalLookAndFeel.getBlack());
1292          else
1293            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1294            
1295        g.drawLine(x + 12, y + 1, x + 13, y + 1);        g.drawLine(x + 12, y + 1, x + 13, y + 1);
1296        g.drawLine(x + 11, y + 2, x + 12, y + 2);        g.drawLine(x + 11, y + 2, x + 12, y + 2);
1297        g.drawLine(x + 10, y + 3, x + 11, y + 3);        g.drawLine(x + 10, y + 3, x + 11, y + 3);
# Line 839  public class MetalIconFactory implements Line 1323  public class MetalIconFactory implements
1323        g.drawLine(x + 13, y + 6, x + 13, y + 6);        g.drawLine(x + 13, y + 6, x + 13, y + 6);
1324        g.drawLine(x + 8, y + 7, x + 13, y + 7);        g.drawLine(x + 8, y + 7, x + 13, y + 7);
1325        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);  
1326        g.drawLine(x + 10, y + 8, x + 10, y + 13);        g.drawLine(x + 10, y + 8, x + 10, y + 13);
1327        g.drawLine(x + 1, y + 14, x + 10, y + 14);        g.drawLine(x + 1, y + 14, x + 10, y + 14);
1328          
1329          if (!b.getModel().isPressed())
1330            {
1331              g.drawLine(x + 2, y + 6, x + 6, y + 6);
1332              g.drawLine(x + 2, y + 6, x + 2, y + 11);
1333            }
1334          
1335          g.setColor(savedColor);
1336      }              }        
1337    }    }
1338        
# Line 891  public class MetalIconFactory implements Line 1381  public class MetalIconFactory implements
1381       */       */
1382      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
1383      {      {
1384        Color color = MetalLookAndFeel.getControlDarkShadow();        Color savedColor = g.getColor();
1385        if (c instanceof JInternalFrame)        
1386          {        AbstractButton b = (AbstractButton) c;
1387            JInternalFrame f = (JInternalFrame) c;        
1388            if (f.isSelected())        // fill the interior
1389              color = MetalLookAndFeel.getPrimaryControlShadow();        if (b.getModel().isPressed())
1390          }          g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1391        g.setColor(color);        else
1392            g.setColor(MetalLookAndFeel.getPrimaryControl());
1393          g.fillRect(x + 2, y + 6, 7, 7);
1394    
1395          if (b.getModel().isPressed())
1396            g.setColor(MetalLookAndFeel.getBlack());
1397          else
1398            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1399              
1400        g.drawLine(x + 9, y + 1, x + 10, y + 1);        g.drawLine(x + 9, y + 1, x + 10, y + 1);
1401        g.fillRect(x + 11, y + 1, 3, 3);        g.fillRect(x + 11, y + 1, 3, 3);
1402        g.fillRect(x + 12, y + 4, 2, 2);        g.fillRect(x + 12, y + 4, 2, 2);
# Line 933  public class MetalIconFactory implements Line 1431  public class MetalIconFactory implements
1431                
1432        // draw white        // draw white
1433        g.setColor(MetalLookAndFeel.getWhite());        g.setColor(MetalLookAndFeel.getWhite());
1434        g.drawLine(x + 2, y + 6, x + 5, y + 6);        if (!b.getModel().isPressed())
1435        g.drawLine(x + 2, y + 7, x + 2, y + 9);          {
1436        g.drawLine(x + 4, y + 11, x + 7, y + 8);            g.drawLine(x + 2, y + 6, x + 5, y + 6);
1437              g.drawLine(x + 2, y + 7, x + 2, y + 9);
1438              g.drawLine(x + 4, y + 11, x + 7, y + 8);
1439            }
1440                
1441        g.drawLine(x + 1, y + 14, x + 10, y + 14);        g.drawLine(x + 1, y + 14, x + 10, y + 14);
1442        g.drawLine(x + 10, y + 5, x + 10, y + 13);        g.drawLine(x + 10, y + 5, x + 10, y + 13);
# Line 944  public class MetalIconFactory implements Line 1445  public class MetalIconFactory implements
1445        g.drawLine(x + 11, y + 4, x + 11, y + 5);        g.drawLine(x + 11, y + 4, x + 11, y + 5);
1446        g.drawLine(x + 13, y + 6, x + 14, y + 6);        g.drawLine(x + 13, y + 6, x + 14, y + 6);
1447        g.drawLine(x + 14, y + 1, x + 14, y + 5);        g.drawLine(x + 14, y + 1, x + 14, y + 5);
1448          g.setColor(savedColor);
1449      }              }        
1450    }    }
1451    
# Line 991  public class MetalIconFactory implements Line 1493  public class MetalIconFactory implements
1493       */       */
1494      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
1495      {      {
1496        Color color = MetalLookAndFeel.getControlDarkShadow();        Color savedColor = g.getColor();
1497        if (c instanceof JInternalFrame)        
1498          {        AbstractButton b = (AbstractButton) c;
1499            JInternalFrame f = (JInternalFrame) c;        
1500            if (f.isSelected())        if (b.getModel().isPressed())
1501              color = MetalLookAndFeel.getPrimaryControlShadow();          g.setColor(MetalLookAndFeel.getBlack());
1502          }        else
1503        g.setColor(color);          // FIXME: here the color depends on whether or not the internal frame
1504            // is selected
1505            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
1506          
1507        g.drawLine(x + 12, y + 1, x + 13, y + 1);        g.drawLine(x + 12, y + 1, x + 13, y + 1);
1508        g.drawLine(x + 11, y + 2, x + 12, y + 2);        g.drawLine(x + 11, y + 2, x + 12, y + 2);
1509        g.drawLine(x + 10, y + 3, x + 11, y + 3);        g.drawLine(x + 10, y + 3, x + 11, y + 3);
# Line 1029  public class MetalIconFactory implements Line 1534  public class MetalIconFactory implements
1534        g.drawLine(x + 11, y + 4, x + 13, y + 2);        g.drawLine(x + 11, y + 4, x + 13, y + 2);
1535        g.drawLine(x + 13, y + 6, x + 13, y + 6);        g.drawLine(x + 13, y + 6, x + 13, y + 6);
1536        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);  
1537        g.drawLine(x + 7, y + 9, x + 7, y + 13);        g.drawLine(x + 7, y + 9, x + 7, y + 13);
1538        g.drawLine(x + 1, y + 14, x + 7, y + 14);        g.drawLine(x + 1, y + 14, x + 7, y + 14);
1539    
1540          if (b.getModel().isPressed())
1541            {
1542              g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
1543              g.fillRect(x + 2, y + 9, 3, 3);
1544            }
1545          else
1546            {
1547              g.drawLine(x + 2, y + 9, x + 4, y + 9);
1548              g.drawLine(x + 2, y + 10, x + 2, y + 11);
1549            }
1550    
1551          g.setColor(savedColor);
1552      }              }        
1553    }    }
1554    
# Line 1388  public class MetalIconFactory implements Line 1904  public class MetalIconFactory implements
1904    }    }
1905    
1906    /**    /**
1907       * Returns an icon for use by the {@link JFileChooser} component.
1908       *
1909       * @return An icon.
1910       */
1911      public static Icon getFileChooserDetailViewIcon()
1912      {
1913        return new FileChooserDetailViewIcon();
1914      }
1915        
1916      /**
1917       * Returns an icon for use by the {@link JFileChooser} component.
1918       *
1919       * @return An icon.
1920       */
1921      public static Icon getFileChooserHomeFolderIcon()
1922      {
1923        return new FileChooserHomeFolderIcon();        
1924      }
1925        
1926      /**
1927       * Returns an icon for use by the {@link JFileChooser} component.
1928       *
1929       * @return An icon.
1930       */
1931      public static Icon getFileChooserListViewIcon()
1932      {
1933        return new FileChooserListViewIcon();
1934      }
1935        
1936      /**
1937       * Returns an icon for use by the {@link JFileChooser} component.
1938       *
1939       * @return An icon.
1940       */
1941      public static Icon getFileChooserNewFolderIcon()
1942      {
1943        return new FileChooserNewFolderIcon();
1944      }
1945        
1946      /**
1947       * Returns an icon for use by the {@link JFileChooser} component.
1948       *
1949       * @return An icon.
1950       */
1951      public static Icon getFileChooserUpFolderIcon()
1952      {
1953        return new FileChooserUpFolderIcon();
1954      }
1955    
1956      /**
1957     * Returns an icon for RadioButtons in the Metal L&amp;F.     * Returns an icon for RadioButtons in the Metal L&amp;F.
1958     *     *
1959     * @return an icon for RadioButtons in the Metal L&amp;F     * @return an icon for RadioButtons in the Metal L&amp;F

Legend:
Removed from v.1.4.2.2  
changed lines
  Added in v.1.4.2.3

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