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

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

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

revision 1.11 by trebligd, Wed Aug 31 16:52:42 2005 UTC revision 1.12 by trebligd, Sat Sep 10 21:52:24 2005 UTC
# Line 262  public class MetalBorders Line 262  public class MetalBorders
262    }    }
263            
264    /**    /**
265       * A border used for a {@link JInternalFrame} when it is being used as a
266       * palette.
267       *
268       * @since 1.3
269       */
270      public static class PaletteBorder
271        extends AbstractBorder
272        implements UIResource
273      {
274        /**
275         * Creates a new <code>PaletteBorder</code>.
276         */
277        public PaletteBorder()
278        {
279        }
280        
281        /**
282         * Returns the border insets.
283         *
284         * @param c  the component (ignored).
285         *
286         * @return The border insets.
287         */
288        public Insets getBorderInsets(Component c)
289        {
290          return getBorderInsets(c, null);
291        }
292    
293        /**
294         * Returns the border insets.
295         *
296         * @param c  the component (ignored).
297         * @param newInsets  the insets object that, if non-<code>null</code>, will
298         *                   be populated with the result from this method.
299         *
300         * @return The border insets.
301         */
302        public Insets getBorderInsets(Component c, Insets newInsets)
303        {        
304          if (newInsets == null)
305            newInsets = new Insets(1, 1, 1, 1);
306          else
307            {
308              newInsets.top = 1;
309              newInsets.left = 1;
310              newInsets.bottom = 1;
311              newInsets.right = 1;
312            }
313          return newInsets;  
314        }
315        
316        /**
317         * Paints the border for the specified component.
318         *
319         * @param c  the component (ignored).
320         * @param g  the graphics device.
321         * @param x  the x-coordinate.
322         * @param y  the y-coordinate.
323         * @param w  the width.
324         * @param h  the height.
325         */
326        public void paintBorder(Component c, Graphics g, int x, int y, int w,
327                int h)
328        {
329          Color savedColor = g.getColor();
330          
331          // draw the outline
332          g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
333          g.drawRect(x, y, w - 1, h - 1);
334          
335          // put a dot in each corner
336          g.setColor(MetalLookAndFeel.getControl());
337          g.fillRect(x, y, 1, 1);
338          g.fillRect(x + w - 1, y, 1, 1);
339          g.fillRect(x + w - 1, y + h - 1, 1, 1);
340          g.fillRect(x, y + h - 1, 1, 1);      
341          g.setColor(savedColor);
342        }
343    
344      }
345        
346      /**
347     * A border used for the {@link JTextField} component.     * A border used for the {@link JTextField} component.
348     */     */
349    public static class TextFieldBorder extends Flush3DBorder    public static class TextFieldBorder extends Flush3DBorder

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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