/[classpath]/classpath/javax/swing/plaf/basic/BasicBorders.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicBorders.java

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

revision 1.9 by brawer, Mon Jun 23 07:16:26 2003 UTC revision 1.10 by brawer, Mon Jun 23 08:49:45 2003 UTC
# Line 53  import javax.swing.JToolBar; Line 53  import javax.swing.JToolBar;
53  import javax.swing.UIDefaults;  import javax.swing.UIDefaults;
54  import javax.swing.UIManager;  import javax.swing.UIManager;
55  import javax.swing.border.AbstractBorder;  import javax.swing.border.AbstractBorder;
56    import javax.swing.border.BevelBorder;
57  import javax.swing.border.Border;  import javax.swing.border.Border;
58  import javax.swing.plaf.UIResource;  import javax.swing.plaf.UIResource;
59  import javax.swing.plaf.BorderUIResource;  import javax.swing.plaf.BorderUIResource;
# Line 356  public class BasicBorders Line 357  public class BasicBorders
357        defaults.getColor("TextField.highlight"));        defaults.getColor("TextField.highlight"));
358    }    }
359        
360      
361      /**
362       * Returns a two-pixel thick, green
363       * <code>LineBorderUIResource</code>.  This is so ugly that look and
364       * feels better use different borders for their progress bars, or
365       * they will look really terrible.
366       *
367       * <p><img src="BasicBorders-1.png" width="120" height="80"
368       * alt="[A screen shot of a border returned by this method]" />
369       */
370      public static Border getProgressBarBorder()
371      {
372        /* There does not seem to exist a way to parametrize the color
373         * or thickness of the border through UIDefaults.
374         */
375        return new BorderUIResource.LineBorderUIResource(Color.green, 2);
376      }
377    
378    
379      /**
380       * Returns a border that is composed of a raised bevel border and a
381       * one-pixel thick line border.
382       *
383       * <p><img src="BasicBorders-2.png" width="300" height="200"
384       * alt="[A screen shot of a border returned by this method]" />
385       *
386       * <p>The colors of the border are retrieved from the
387       * <code>UIDefaults</code> of the currently active look and feel
388       * using the keys <code>&#x201c;InternalFrame.borderShadow&#x201d;</code>,
389       * <code>&#x201c;InternalFrame.borderDarkShadow&#x201d;</code>,
390       * <code>&#x201c;InternalFrame.borderLight&#x201d;</code>,
391       * <code>&#x201c;InternalFrame.borderHighlight&#x201d;</code>, and
392       * (for the inner one-pixel thick line)
393       * <code>&#x201c;InternalFrame.borderColor&#x201d;</code>.
394       */
395      public static Border getInternalFrameBorder()
396      {
397        UIDefaults defaults;
398        Color shadow, darkShadow, highlight, lightHighlight, line;
399    
400        /* See comment in methods above for why this border is not shared. */
401        defaults = UIManager.getLookAndFeelDefaults();
402        
403        shadow = defaults.getColor("InternalFrame.borderShadow");
404        darkShadow = defaults.getColor("InternalFrame.borderDarkShadow");
405        highlight = defaults.getColor("InternalFrame.borderLight");
406        lightHighlight = defaults.getColor("InternalFrame.borderHighlight");
407        line = defaults.getColor("InternalFrame.borderColor");
408    
409        return new BorderUIResource.CompoundBorderUIResource(
410          /* outer border */
411          new BorderUIResource.BevelBorderUIResource(
412            BevelBorder.RAISED,
413            (highlight != null) ? highlight : Color.lightGray,
414            (lightHighlight != null) ? lightHighlight : Color.white,
415            (darkShadow != null) ? darkShadow : Color.black,
416            (shadow != null) ? shadow : Color.gray),
417    
418          /* inner border */
419          new BorderUIResource.LineBorderUIResource(
420            (line != null) ? line : Color.lightGray));
421      }
422    
423    
424    /**    /**
425     * Returns a shared MarginBorder.     * Returns a shared MarginBorder.
426     */     */

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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