/*************** <auto-copyright.pl BEGIN do not edit this line> **************
 *
 * VR Juggler is (C) Copyright 1998-2005 by Iowa State University
 *
 * Original Authors:
 *   Allen Bierbaum, Christopher Just,
 *   Patrick Hartling, Kevin Meinert,
 *   Carolina Cruz-Neira, Albert Baker
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * -----------------------------------------------------------------
 * File:          $RCSfile$
 * Date modified: $Date$
 * Version:       $Revision$
 * -----------------------------------------------------------------
 *
 *************** <auto-copyright.pl END do not edit this line> ***************/

package org.vrjuggler.vrjconfig.customeditors.display_window;

import javax.swing.*;
import java.awt.*;


public class DesktopBackgroundImage extends JComponent
{
   public void setImageFile(String imageFile)
   {
      setImageFile(getClass().getResource(imageFile));
   }

   public void setImageFile(java.net.URL url)
   {
      if (url != null)
      {
         mImage = Toolkit.getDefaultToolkit().getImage(url);
         if ( mImage != null )
         {
            MediaTracker tracker = new MediaTracker(this);
            tracker.addImage(mImage, 0);
            try
            {
               tracker.waitForAll();
            }
            catch (InterruptedException e)
            {
               System.out.println(e);
               e.printStackTrace();
            }
         }
      }
   }

   protected void drawInnerBorder(Graphics g, int x, int y, int w, int h)
   {
      Color oldColor = g.getColor();

      g.translate(x, y);

      Color highlightOuterColor = getBackground().brighter().brighter();
      Color highlightInnerColor = getBackground().brighter();
      Color shadowOuterColor = getBackground().darker().darker();
      Color shadowInnerColor = getBackground().darker();

      g.setColor(shadowInnerColor);
      g.drawLine(0, 0, 0, h-1);
      g.drawLine(1, 0, w-1, 0);

      g.setColor(shadowOuterColor);
      g.drawLine(1, 1, 1, h-2);
      g.drawLine(2, 1, w-2, 1);

      g.setColor(highlightOuterColor);
      g.drawLine(0, h-1, w-1, h-1);
      g.drawLine(w-1, 1, w-1, h-2);

      g.setColor(highlightInnerColor);
      g.drawLine(2, h-2, w-2, h-2);
      g.drawLine(w-2, 2, w-2, h-3);

      g.translate(-x, -y);
      g.setColor(oldColor);
   }

   protected void drawBar(Graphics g, int x, int y, int w, int h)
   {
           Color oldColor = g.getColor();

           g.translate(x, y);

           Color highlightOuterColor = getBackground().brighter().brighter();
           Color highlightInnerColor = getBackground().brighter();
           Color shadowOuterColor = getBackground().darker().darker();
           Color shadowInnerColor = getBackground().darker();

           g.setColor(shadowInnerColor);
           g.drawLine(1, 0, w-1, 0);

           g.setColor(shadowOuterColor);
           g.drawLine(2, 1, w-2, 1);

           g.setColor(highlightOuterColor);
           g.drawLine(0, -1, w-1, -1);

           g.setColor(highlightInnerColor);
           g.drawLine(2, -2, w-2, -2);

           g.translate(-x, -y);
           g.setColor(oldColor);
   }

   protected void paintComponent(Graphics g)
   {
      if ( ! (g instanceof Graphics2D) )
      {
         return;
      }

      Insets insets = getInsets();

      Dimension d;
      if(getParent() != null)
      {
         d = getParent().getSize();
         setSize(d);
      }
      else
      {
         d = getSize();
      }

      if ( mImage != null )
      {
         int current_width = d.width - insets.left - insets.right;
         int current_height = d.height - insets.top - insets.bottom;

         g.drawImage(mImage, insets.left, insets.right, current_width,
                     current_height, this);
      }
   }

   private Image mImage = null;
}

@@ -3106,29 +3106,24 @@
 %0A   %7B%0A      
-     
 Color oldCol
@@ -3138,29 +3138,24 @@
 etColor();%0A%0A
-     
       g.tran
@@ -3170,29 +3170,24 @@
  y);%0A%0A      
-     
 Color highli
@@ -3233,37 +3233,32 @@
 r().brighter();%0A
-     
       Color high
@@ -3301,37 +3301,32 @@
 ighter();%0A      
-     
 Color shadowOute
@@ -3365,29 +3365,24 @@
 ).darker();%0A
-     
       Color 
@@ -3425,37 +3425,32 @@
 arker();%0A%0A      
-     
 g.setColor(shado
@@ -3455,37 +3455,32 @@
 dowInnerColor);%0A
-     
       g.drawLine
@@ -3494,37 +3494,32 @@
 w-1, 0);%0A%0A      
-     
 g.setColor(shado
@@ -3524,37 +3524,32 @@
 dowOuterColor);%0A
-     
       g.drawLine
@@ -3563,37 +3563,32 @@
 w-2, 1);%0A%0A      
-     
 g.setColor(highl
@@ -3596,37 +3596,32 @@
 ghtOuterColor);%0A
-     
       g.drawLine
@@ -3641,29 +3641,24 @@
 -1);%0A%0A      
-     
 g.setColor(h
@@ -3678,21 +3678,16 @@
 Color);%0A
-     
       g.
@@ -3719,21 +3719,16 @@
 %0A%0A      
-     
 g.transl
@@ -3740,21 +3740,16 @@
 x, -y);%0A
-     
       g.

Fixed indentation.