src/share/classes/javax/swing/plaf/metal/MetalBumps.java

Print this page




  50     protected Color shadowColor;
  51     protected Color backColor;
  52 
  53     private static final Object METAL_BUMPS = new Object();
  54     protected BumpBuffer buffer;
  55 
  56     /**
  57      * Creates MetalBumps of the specified size with the specified colors.
  58      * If <code>newBackColor</code> is null, the background will be
  59      * transparent.
  60      */
  61     public MetalBumps( int width, int height,
  62                        Color newTopColor, Color newShadowColor, Color newBackColor ) {
  63         setBumpArea( width, height );
  64         setBumpColors( newTopColor, newShadowColor, newBackColor );
  65     }
  66 
  67     private static BumpBuffer createBuffer(GraphicsConfiguration gc,
  68                                            Color topColor, Color shadowColor, Color backColor) {
  69         AppContext context = AppContext.getAppContext();

  70         List<BumpBuffer> buffers = (List<BumpBuffer>) context.get(METAL_BUMPS);
  71         if (buffers == null) {
  72             buffers = new ArrayList<BumpBuffer>();
  73             context.put(METAL_BUMPS, buffers);
  74         }
  75         for (BumpBuffer buffer : buffers) {
  76             if (buffer.hasSameConfiguration(gc, topColor, shadowColor, backColor)) {
  77                 return buffer;
  78             }
  79         }
  80         BumpBuffer buffer = new BumpBuffer(gc, topColor, shadowColor, backColor);
  81         buffers.add(buffer);
  82         return buffer;
  83     }
  84 
  85     public void setBumpArea( Dimension bumpArea ) {
  86         setBumpArea( bumpArea.width, bumpArea.height );
  87     }
  88 
  89     public void setBumpArea( int width, int height ) {




  50     protected Color shadowColor;
  51     protected Color backColor;
  52 
  53     private static final Object METAL_BUMPS = new Object();
  54     protected BumpBuffer buffer;
  55 
  56     /**
  57      * Creates MetalBumps of the specified size with the specified colors.
  58      * If <code>newBackColor</code> is null, the background will be
  59      * transparent.
  60      */
  61     public MetalBumps( int width, int height,
  62                        Color newTopColor, Color newShadowColor, Color newBackColor ) {
  63         setBumpArea( width, height );
  64         setBumpColors( newTopColor, newShadowColor, newBackColor );
  65     }
  66 
  67     private static BumpBuffer createBuffer(GraphicsConfiguration gc,
  68                                            Color topColor, Color shadowColor, Color backColor) {
  69         AppContext context = AppContext.getAppContext();
  70         @SuppressWarnings("unchecked")
  71         List<BumpBuffer> buffers = (List<BumpBuffer>) context.get(METAL_BUMPS);
  72         if (buffers == null) {
  73             buffers = new ArrayList<BumpBuffer>();
  74             context.put(METAL_BUMPS, buffers);
  75         }
  76         for (BumpBuffer buffer : buffers) {
  77             if (buffer.hasSameConfiguration(gc, topColor, shadowColor, backColor)) {
  78                 return buffer;
  79             }
  80         }
  81         BumpBuffer buffer = new BumpBuffer(gc, topColor, shadowColor, backColor);
  82         buffers.add(buffer);
  83         return buffer;
  84     }
  85 
  86     public void setBumpArea( Dimension bumpArea ) {
  87         setBumpArea( bumpArea.width, bumpArea.height );
  88     }
  89 
  90     public void setBumpArea( int width, int height ) {