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

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

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

revision 1.1.2.4 by gnu_andrew, Wed Nov 2 00:44:01 2005 UTC revision 1.1.2.5 by gnu_andrew, Sun Nov 27 21:00:41 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package javax.swing.plaf.metal;  package javax.swing.plaf.metal;
40    
41    import java.awt.Color;
42    import java.awt.Graphics;
43    import java.awt.Insets;
44    
45  import javax.swing.JComponent;  import javax.swing.JComponent;
46  import javax.swing.JProgressBar;  import javax.swing.JProgressBar;
47  import javax.swing.plaf.ComponentUI;  import javax.swing.plaf.ComponentUI;
# Line 67  public class MetalProgressBarUI extends Line 71  public class MetalProgressBarUI extends
71    {    {
72      return new MetalProgressBarUI();      return new MetalProgressBarUI();
73    }    }
74    
75      /**
76       * Performs the painting for determinate progress bars. This calls the
77       * superclass behaviour and then adds some highlighting to the upper and left
78       * edge of the progress bar.
79       *
80       * @param g the graphics context
81       * @param c not used here
82       */
83      public void paintDeterminate(Graphics g, JComponent c)
84      {
85        super.paintDeterminate(g, c);
86        Color saved = g.getColor();
87        Insets i = progressBar.getInsets();
88        int w = progressBar.getWidth();
89        int h = progressBar.getHeight();
90        int orientation = progressBar.getOrientation();
91        
92        Color shadow = MetalLookAndFeel.getControlShadow();
93        g.setColor(shadow);
94    
95        g.drawLine(i.left, i.top, w - i.right, i.top);
96        g.drawLine(i.left, i.top, i.left, h - i.bottom);
97        int full = getAmountFull(i, w, h);
98        if (full > 0)
99          {
100            Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow();
101            g.setColor(darkShadow);
102            if (orientation == JProgressBar.HORIZONTAL)
103              {
104                g.drawLine(i.left, i.top, i.left, h - i.bottom);
105                g.drawLine(i.left, i.top, i.left + full - 1, i.top);
106              }
107            else
108              {
109                if (full >= (h - i.top - i.bottom))
110                  g.drawLine(i.left, i.top, w - i.right, i.top);
111                g.drawLine(i.left, h - i.bottom, i.left, h - i.bottom - full);
112              }
113          }
114        g.setColor(saved);
115      }
116    
117      /**
118       * Performs the painting for indeterminate progress bars. This calls the
119       * superclass behaviour and then adds some highlighting to the upper and left
120       * edge of the progress bar.
121       *
122       * @param g the graphics context
123       * @param c not used here
124       */
125      public void paintIndeterminate(Graphics g, JComponent c)
126      {
127        super.paintIndeterminate(g, c);
128        Color saved = g.getColor();
129        Insets i = progressBar.getInsets();
130        int w = progressBar.getWidth();
131        int h = progressBar.getHeight();
132        Color shadow = MetalLookAndFeel.getControlShadow();
133        g.setColor(shadow);
134        g.drawLine(i.left, i.top, w - i.right, i.top);
135        g.drawLine(i.left, i.top, i.left, h - i.bottom);
136    
137        boxRect = getBox(boxRect);
138        Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow();
139        g.setColor(darkShadow);
140        int orientation = progressBar.getOrientation();
141        if (orientation == JProgressBar.HORIZONTAL)
142          g.drawLine(boxRect.x, i.top, boxRect.x + boxRect.width - 1, i.top);
143        else
144          g.drawLine(i.left, boxRect.y, i.left, boxRect.y + boxRect.height - 1);
145        g.setColor(saved);
146      }
147  }  }

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.1.2.5

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