[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: metal plaf implementation

Kaffe CVS cvs-commits at kaffe.org
Tue Apr 19 11:49:41 PDT 2005


PatchSet 5724 
Date: 2005/04/19 18:43:12
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: metal plaf implementation

Members: 
	ChangeLog:1.3891->1.3892 
	libraries/javalib/Makefile.am:1.340->1.341 
	libraries/javalib/Makefile.in:1.428->1.429 
	libraries/javalib/all.files:1.115->1.116 
	libraries/javalib/javax/swing/plaf/metal/MetalBorders.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalButtonUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalCheckBoxUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalComboBoxUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalDesktopIconUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalInternalFrameUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalLabelUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalLookAndFeel.java:1.4->1.5 
	libraries/javalib/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalProgressBarUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalRadioButtonUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalRootPaneUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalScrollBarUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalScrollPaneUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalSeparatorUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalSliderUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalSplitPaneUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalTabbedPaneUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalTextFieldUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalToggleButtonUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalToolBarUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalToolTipUI.java:INITIAL->1.1 
	libraries/javalib/javax/swing/plaf/metal/MetalTreeUI.java:INITIAL->1.1 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3891 kaffe/ChangeLog:1.3892
--- kaffe/ChangeLog:1.3891	Tue Apr 19 18:11:54 2005
+++ kaffe/ChangeLog	Tue Apr 19 18:43:12 2005
@@ -2,6 +2,157 @@
 
         Resynced with GNU Classpath.
 
+	2005-04-19  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalBorders.java
+        (getBorderInsets): Likewise.
+
+	2005-04-18  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalInternalFrameUI.java
+        (createUI): Do not share instances between components.
+        * javax/swing/plaf/metal/MetalSliderUI.java
+        (createUI): Do not share instances between components.
+
+	2005-04-18  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalBorders:
+        (PopupMenuBorder): Added.
+        * javax/swing/plaf/metal/MetalLookAndFeel
+        (initComponentDefaults): Added PopupMenuBorder.
+
+	2005-04-18  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalScrollBarUI.java:
+        (createUI): Instances cannot be shared among JScrollPanes.
+
+	2005-04-18  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalLookAndFeel.java
+        (initComponentDefaults): Added defaults for Menu, MenuBar
+        MenuEntry fonts.
+
+	2005-04-18  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalBorders.java:
+        Adjusted insets of ButtonBorder.
+        (RolloverMarginBorder): Added class for toolbar buttons.
+        (getButtonBorder): Adjusted factory method to return a shared
+        instance of button border.
+        (getToolbarButtonBorder): Added factory method to return a shared
+        instance of toolbar button border.
+        (getMarginBorder): Added factory method to return a shared
+        instance of margin border.
+        * javax/swing/plaf/metal/MetalButtonUI.java
+        (installDefauls): If button is child of a JToolBar then set
+        special border on this button.
+
+	2005-04-15  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalLookAndFeel.java
+        (initComponentDefaults): Added Label.font.
+        (initSystemColorDefaults): Added this method and adjusted the
+        general control color.
+
+	2005-04-15  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalTabbedPaneUI.java:
+        Added newline between import blocks. Changed Map to
+        HashMap in field declarations.
+
+	2005-04-15  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalBorders.java:
+        Added.
+        * javax/swing/plaf/metal/MetalButtonUI.java:
+        (installDefaults): Install button font.
+        * javax/swing/plaf/metal/MetalLookAndFeel.java:
+        (initComponentDefaults): Added button border, font and margin.
+        Changed components background color to the Metal current themes
+        standard color.
+
+	2005-04-15  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+        (createUI): Create one MetalTabbedPaneUI per Component instead
+        of sharing one instance.
+
+	2005-04-15  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalLookAndFeel.java
+        (initComponentDefaults): Added to set Metal specific component
+        defaults.
+
+	2005-04-14  Mark Wielaard  <mark at klomp.org>
+
+        * javax/swing/plaf/metal/MetalLookAndFeel.java
+        (initClassDefaults): Call super.initClassDefaults().
+
+	2005-04-14  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalLookAndFeel.java
+        (initClassDefaults): Added to include the *UI classes.
+
+	2005-04-14  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalComboBoxUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalDesktopIconUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalInternalFrameUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalProgressBarUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalRootPaneUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalScrollBarUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalSeparatorUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalSliderUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalSplitPaneUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalTextFieldUI.java:
+        Added.
+        * javax/swing/plaf/metal/MetalToggleButtonUI.java:
+
+	2005-04-14  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalButtonUI.java:
+        Fixed year in copyright notice.
+        * javax/swing/plaf/metal/MetalCheckBoxUI.java:
+        Fixed year in copyright notice.
+        * javax/swing/plaf/metal/MetalLabelUI.java:
+        Fixed year in copyright notice.
+        * javax/swing/plaf/metal/MetalRadioButtonUI.java:
+        Fixed year in copyright notice.
+        * javax/swing/plaf/metal/MetalScrollPaneUI.java:
+        Fixed year in copyright notice.
+        * javax/swing/plaf/metal/MetalTabbedPaneUI.java:
+        Fixed year in copyright notice.
+
+	2005-04-13  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalButtonUI.java:
+        Added skeleton class.
+        * javax/swing/plaf/metal/MetalCheckBoxUI.java:
+        Added skeleton class.
+        * javax/swing/plaf/metal/MetalLabelUI.java:
+        Added skeleton class.
+        * javax/swing/plaf/metal/MetalRadioButtonUI.java:
+        Added skeleton class.
+        * javax/swing/plaf/metal/MetalScrollPaneUI.java:
+        Added skeleton class.
+        * javax/swing/plaf/metal/MetalTabbedPaneUI.java:
+        Added skeleton class.
+
+2005-04-19  Dalibor Topic  <robilad at kaffe.org>
+
+        Resynced with GNU Classpath.
+
 	2005-04-13  Roman Kennke  <roman at kennke.org>
 
         * java/awt/MediaTracker.java:
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.340 kaffe/libraries/javalib/Makefile.am:1.341
--- kaffe/libraries/javalib/Makefile.am:1.340	Tue Apr 19 17:34:40 2005
+++ kaffe/libraries/javalib/Makefile.am	Tue Apr 19 18:43:16 2005
@@ -4018,8 +4018,30 @@
 	javax/swing/plaf/basic/ComboPopup.java
 javax_swing_plaf_metal_SRCS = \
 	javax/swing/plaf/metal/DefaultMetalTheme.java \
+	javax/swing/plaf/metal/MetalBorders.java \
+	javax/swing/plaf/metal/MetalButtonUI.java \
+	javax/swing/plaf/metal/MetalCheckBoxUI.java \
+	javax/swing/plaf/metal/MetalComboBoxUI.java \
+	javax/swing/plaf/metal/MetalDesktopIconUI.java \
+	javax/swing/plaf/metal/MetalInternalFrameUI.java \
+	javax/swing/plaf/metal/MetalLabelUI.java \
 	javax/swing/plaf/metal/MetalLookAndFeel.java \
-	javax/swing/plaf/metal/MetalTheme.java
+	javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java \
+	javax/swing/plaf/metal/MetalProgressBarUI.java \
+	javax/swing/plaf/metal/MetalRadioButtonUI.java \
+	javax/swing/plaf/metal/MetalRootPaneUI.java \
+	javax/swing/plaf/metal/MetalScrollBarUI.java \
+	javax/swing/plaf/metal/MetalScrollPaneUI.java \
+	javax/swing/plaf/metal/MetalSeparatorUI.java \
+	javax/swing/plaf/metal/MetalSliderUI.java \
+	javax/swing/plaf/metal/MetalSplitPaneUI.java \
+	javax/swing/plaf/metal/MetalTabbedPaneUI.java \
+	javax/swing/plaf/metal/MetalTextFieldUI.java \
+	javax/swing/plaf/metal/MetalTheme.java \
+	javax/swing/plaf/metal/MetalToggleButtonUI.java \
+	javax/swing/plaf/metal/MetalToolBarUI.java \
+	javax/swing/plaf/metal/MetalToolTipUI.java \
+	javax/swing/plaf/metal/MetalTreeUI.java
 javax_swing_table_SRCS = \
 	javax/swing/table/AbstractTableModel.java \
 	javax/swing/table/DefaultTableCellRenderer.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.428 kaffe/libraries/javalib/Makefile.in:1.429
--- kaffe/libraries/javalib/Makefile.in:1.428	Tue Apr 19 17:34:41 2005
+++ kaffe/libraries/javalib/Makefile.in	Tue Apr 19 18:43:20 2005
@@ -4587,8 +4587,30 @@
 
 javax_swing_plaf_metal_SRCS = \
 	javax/swing/plaf/metal/DefaultMetalTheme.java \
+	javax/swing/plaf/metal/MetalBorders.java \
+	javax/swing/plaf/metal/MetalButtonUI.java \
+	javax/swing/plaf/metal/MetalCheckBoxUI.java \
+	javax/swing/plaf/metal/MetalComboBoxUI.java \
+	javax/swing/plaf/metal/MetalDesktopIconUI.java \
+	javax/swing/plaf/metal/MetalInternalFrameUI.java \
+	javax/swing/plaf/metal/MetalLabelUI.java \
 	javax/swing/plaf/metal/MetalLookAndFeel.java \
-	javax/swing/plaf/metal/MetalTheme.java
+	javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java \
+	javax/swing/plaf/metal/MetalProgressBarUI.java \
+	javax/swing/plaf/metal/MetalRadioButtonUI.java \
+	javax/swing/plaf/metal/MetalRootPaneUI.java \
+	javax/swing/plaf/metal/MetalScrollBarUI.java \
+	javax/swing/plaf/metal/MetalScrollPaneUI.java \
+	javax/swing/plaf/metal/MetalSeparatorUI.java \
+	javax/swing/plaf/metal/MetalSliderUI.java \
+	javax/swing/plaf/metal/MetalSplitPaneUI.java \
+	javax/swing/plaf/metal/MetalTabbedPaneUI.java \
+	javax/swing/plaf/metal/MetalTextFieldUI.java \
+	javax/swing/plaf/metal/MetalTheme.java \
+	javax/swing/plaf/metal/MetalToggleButtonUI.java \
+	javax/swing/plaf/metal/MetalToolBarUI.java \
+	javax/swing/plaf/metal/MetalToolTipUI.java \
+	javax/swing/plaf/metal/MetalTreeUI.java
 
 javax_swing_table_SRCS = \
 	javax/swing/table/AbstractTableModel.java \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.115 kaffe/libraries/javalib/all.files:1.116
--- kaffe/libraries/javalib/all.files:1.115	Tue Apr 19 17:34:43 2005
+++ kaffe/libraries/javalib/all.files	Tue Apr 19 18:43:22 2005
@@ -3460,8 +3460,30 @@
 javax/swing/plaf/basic/BasicViewportUI.java
 javax/swing/plaf/basic/ComboPopup.java
 javax/swing/plaf/metal/DefaultMetalTheme.java
+javax/swing/plaf/metal/MetalBorders.java
+javax/swing/plaf/metal/MetalButtonUI.java
+javax/swing/plaf/metal/MetalCheckBoxUI.java
+javax/swing/plaf/metal/MetalComboBoxUI.java
+javax/swing/plaf/metal/MetalDesktopIconUI.java
+javax/swing/plaf/metal/MetalInternalFrameUI.java
+javax/swing/plaf/metal/MetalLabelUI.java
 javax/swing/plaf/metal/MetalLookAndFeel.java
+javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
+javax/swing/plaf/metal/MetalProgressBarUI.java
+javax/swing/plaf/metal/MetalRadioButtonUI.java
+javax/swing/plaf/metal/MetalRootPaneUI.java
+javax/swing/plaf/metal/MetalScrollBarUI.java
+javax/swing/plaf/metal/MetalScrollPaneUI.java
+javax/swing/plaf/metal/MetalSeparatorUI.java
+javax/swing/plaf/metal/MetalSliderUI.java
+javax/swing/plaf/metal/MetalSplitPaneUI.java
+javax/swing/plaf/metal/MetalTabbedPaneUI.java
+javax/swing/plaf/metal/MetalTextFieldUI.java
 javax/swing/plaf/metal/MetalTheme.java
+javax/swing/plaf/metal/MetalToggleButtonUI.java
+javax/swing/plaf/metal/MetalToolBarUI.java
+javax/swing/plaf/metal/MetalToolTipUI.java
+javax/swing/plaf/metal/MetalTreeUI.java
 javax/swing/table/AbstractTableModel.java
 javax/swing/table/DefaultTableCellRenderer.java
 javax/swing/table/DefaultTableColumnModel.java
===================================================================
Checking out kaffe/libraries/javalib/javax/swing/plaf/metal/MetalBorders.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/javax/swing/plaf/metal/MetalBorders.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/javax/swing/plaf/metal/MetalBorders.java	Tue Apr 19 18:49:40 2005
@@ -0,0 +1,367 @@
+/* MetalBorders.java
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+
+import javax.swing.AbstractButton;
+import javax.swing.ButtonModel;
+import javax.swing.JButton;
+import javax.swing.border.AbstractBorder;
+import javax.swing.border.Border;
+import javax.swing.plaf.BorderUIResource;
+import javax.swing.plaf.UIResource;
+import javax.swing.plaf.basic.BasicGraphicsUtils;
+import javax.swing.plaf.basic.BasicBorders;
+
+/**
+ * This factory class creates borders for the different Swing components
+ * UI.
+ *
+ * @author Roman Kennke (roman at kennke.org)
+ */
+public class MetalBorders
+{
+
+  /** The shared instance for getButtonBorder(). */
+  private static Border buttonBorder;
+
+  /** The shared instance for getRolloverButtonBorder(). */
+  private static Border toolbarButtonBorder;
+
+  /**
+   * A MarginBorder that gets shared by multiple components.
+   * Created on demand by the private helper function {@link
+   * #getMarginBorder()}.
+   */
+  private static BasicBorders.MarginBorder marginBorder;
+
+  /**
+   * The border that is drawn around Swing buttons.
+   */
+  public static class MetalButtonBorder
+    extends AbstractBorder
+    implements UIResource
+  {
+    /** The borders insets. */
+    protected static Insets borderInsets = new Insets(3, 3, 3, 3);
+
+    /**
+     * Creates a new instance of ButtonBorder.
+     */
+    public MetalButtonBorder()
+    {
+    }
+
+    /**
+     * Paints the button border.
+     *
+     * @param c the component for which we paint the border
+     * @param g the Graphics context to use
+     * @param x the X coordinate of the upper left corner of c
+     * @param y the Y coordinate of the upper left corner of c
+     * @param w the width of c
+     * @param h the height of c
+     */
+    public void paintBorder(Component c, Graphics g, int x, int y, int w,
+                            int h)
+    {
+      ButtonModel bmodel = null;
+      
+      if (c instanceof AbstractButton)
+        bmodel = ((AbstractButton) c).getModel();
+
+      Color darkShadow = MetalLookAndFeel.getControlDarkShadow();
+      Color shadow = MetalLookAndFeel.getControlShadow();
+      Color light = MetalLookAndFeel.getWhite();
+      Color middle = MetalLookAndFeel.getControl();
+
+      // draw dark border
+      g.setColor(darkShadow);
+      g.drawRect(x, y, w - 2, h - 2);
+
+      if (!bmodel.isPressed())
+        {
+          // draw light border
+          g.setColor(light);
+          g.drawRect(x + 1, y + 1, w - 2, h - 2);
+
+          // draw crossing pixels of both borders
+          g.setColor(middle);
+          g.drawRect(x + 1, y + h - 2, 0, 0);
+          g.drawRect(x + w - 2, y + 1, 0, 0);
+        }
+      else
+        {
+          // draw light border
+          g.setColor(light);
+          g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+          g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+
+          // draw shadow border
+          g.setColor(middle);
+          g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+          g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+
+          // draw crossing pixels of both borders
+          g.setColor(shadow);
+          g.drawRect(x + 1, y + h - 2, 0, 0);
+          g.drawRect(x + w - 2, y + 1, 0, 0);
+        }
+    }
+
+    /**
+     * Returns the insets of the ButtonBorder.
+     *
+     * @param c the component for which the border is used
+     *
+     * @return the insets of the ButtonBorder
+     */
+    public Insets getBorderInsets(Component c)
+    {
+      return getBorderInsets(c, null);
+    }
+
+    /**
+     * Returns the insets of the ButtonBorder in the specified Insets object.
+     *
+     * @param c the component for which the border is used
+     * @param newInsets the insets object where to put the values
+     *
+     * @return the insets of the ButtonBorder
+     */
+    public Insets getBorderInsets(Component c, Insets newInsets)
+    {
+      if (newInsets == null)
+        newInsets = new Insets(0, 0, 0, 0);
+
+      AbstractButton b = (AbstractButton) c;
+      newInsets.bottom = borderInsets.bottom;
+      newInsets.left = borderInsets.left;
+      newInsets.right = borderInsets.right;
+      newInsets.top = borderInsets.top;
+      return newInsets;
+    }
+  }
+
+  /**
+   * This border is used in Toolbar buttons as inner border.
+   */
+  static class RolloverMarginBorder extends AbstractBorder
+  {
+    /** The borders insets. */
+    protected static Insets borderInsets = new Insets(3, 3, 3, 3);
+
+    /**
+     * Creates a new instance of RolloverBorder.
+     */
+    public RolloverMarginBorder()
+    {
+    }
+    
+    /**
+     * Returns the insets of the RolloverBorder.
+     *
+     * @param c the component for which the border is used
+     *
+     * @return the insets of the RolloverBorder
+     */
+    public Insets getBorderInsets(Component c)
+    {
+      return getBorderInsets(c, null);
+    }
+
+    /**
+     * Returns the insets of the RolloverMarginBorder in the specified
+     * Insets object.
+     *
+     * @param c the component for which the border is used
+     * @param newInsets the insets object where to put the values
+     *
+     * @return the insets of the RolloverMarginBorder
+     */
+    public Insets getBorderInsets(Component c, Insets newInsets)
+    {
+      if (newInsets == null)
+        newInsets = new Insets(0, 0, 0, 0);
+
+      AbstractButton b = (AbstractButton) c;
+      Insets margin = b.getMargin();
+      newInsets.bottom = borderInsets.bottom;
+      newInsets.left = borderInsets.left;
+      newInsets.right = borderInsets.right;
+      newInsets.top = borderInsets.top;
+      return newInsets;
+    }
+  }
+
+  /**
+   * A border implementation for popup menus.
+   */
+  public static class PopupMenuBorder
+    extends AbstractBorder
+    implements UIResource
+  {
+
+    /** The border's insets. */
+    protected static Insets borderInsets = new Insets(2, 2, 1, 1);
+
+    /**
+     * Constructs a new PopupMenuBorder.
+     */
+    public PopupMenuBorder()
+    {
+    }
+    
+    /**
+     * Returns the insets of the border, creating a new Insets instance
+     * with each call.
+     *
+     * @param c the component for which we return the border insets
+     *          (not used here)
+     */
+    public Insets getBorderInsets(Component c)
+    {
+      return getBorderInsets(c, null);
+    }
+    
+    /**
+     * Returns the insets of the border, using the supplied Insets instance.
+     *
+     * @param c the component for which we return the border insets
+     *          (not used here)
+     * @param i the Insets instance to fill with the Insets values
+     */
+    public Insets getBorderInsets(Component c, Insets i)
+    {
+      Insets insets;
+      if (i == null)
+        insets = new Insets(borderInsets.top, borderInsets.left,
+                            borderInsets.bottom, borderInsets.right);
+      else
+        {
+          insets = i;
+          insets.top = borderInsets.top;
+          insets.left = borderInsets.left;
+          insets.bottom = borderInsets.bottom;
+          insets.right = borderInsets.right;
+        }
+      
+      return insets;
+    }
+
+    /**
+     * Paints the border for component <code>c</code> using the
+     * Graphics context <code>g</code> with the dimension
+     * <code>x, y, w, h</code>.
+     *
+     * @param c the component for which we paint the border
+     * @param g the Graphics context to use
+     * @param x the X coordinate of the upper left corner of c
+     * @param y the Y coordinate of the upper left corner of c
+     * @param w the width of c
+     * @param h the height of c
+     */
+    public void paintBorder(Component c, Graphics g, int x, int y, int w,
+                            int h)
+    {
+      Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow();
+      Color light = MetalLookAndFeel.getPrimaryControlHighlight();
+
+      // draw dark outer border
+      g.setColor(darkShadow);
+      g.drawRect(x, y, w - 1, h - 1);
+      
+      // draw highlighted inner border (only top and left)
+      g.setColor(light);
+      g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+      g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+    }
+    
+  }
+
+  /**
+   * Returns a border for Swing buttons in the Metal Look &amp; Feel.
+   *
+   * @return a border for Swing buttons in the Metal Look &amp; Feel
+   */
+  public static Border getButtonBorder()
+  {
+    if (buttonBorder == null)
+      {
+        Border outer = new MetalButtonBorder();
+        Border inner = getMarginBorder();
+        buttonBorder = new BorderUIResource.CompoundBorderUIResource
+            (outer, inner);
+      }
+    return buttonBorder;
+  }
+
+  /**
+   * Returns a border for Toolbar buttons in the Metal Look &amp; Feel.
+   *
+   * @return a border for Toolbar buttons in the Metal Look &amp; Feel
+   */
+  static Border getToolbarButtonBorder()
+  {
+    if (toolbarButtonBorder == null)
+      {
+        Border outer = new MetalButtonBorder();
+        Border inner = new RolloverMarginBorder();
+        toolbarButtonBorder = new BorderUIResource.CompoundBorderUIResource
+          (outer, inner);
+      }
+    return toolbarButtonBorder;
+  }
+
+  /**
+   * Returns a shared instance of {@link BasicBorders.MarginBorder}.
+   *
+   * @return a shared instance of {@link BasicBorders.MarginBorder}
+   */
+  static Border getMarginBorder()
+  {
+    if (marginBorder == null)
+      marginBorder = new BasicBorders.MarginBorder();
+    return marginBorder;
+  }
+}
===================================================================
Checking out kaffe/libraries/javalib/javax/swing/plaf/metal/MetalButtonUI.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/javax/swing/plaf/metal/MetalButtonUI.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/javax/swing/plaf/metal/MetalButtonUI.java	Tue Apr 19 18:49:41 2005
@@ -0,0 +1,101 @@
+/* MetalButtonUI.java
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import javax.swing.AbstractButton;
+import javax.swing.JComponent;
+import javax.swing.JToolBar;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicButtonUI;
+
+/**
+ * The Metal Look &amp; Feel implementation for
+ * {@link javax.swing.AbstractButton}s.
+ *
+ * @author Roman Kennke (roman at kennke.org)
+ */
+public class MetalButtonUI
+  extends BasicButtonUI
+{
+
+  // FIXME: probably substitute with a Map in the future in the case
+  // that this UI becomes stateful
+
+  /** The cached MetalButtonUI instance. */
+  private static MetalButtonUI instance = null;
+
+  /**
+   * Creates a new instance of MetalButtonUI.
+   */
+  public MetalButtonUI()
+  {
+    super();
+  }
+
+  /**
+   * Returns an instance of MetalButtonUI.
+   *
+   * @param component a button for which a UI instance should be returned
+   */
+  public static ComponentUI createUI(JComponent component)
+  {
+    if (instance == null)
+      instance = new MetalButtonUI();
+    return instance;
+  }
+
+  /**
+   * Install the Look &amp; Feel defaults for Buttons.
+   *
+   * @param button the button for which to install the Look &amp; Feel
+   */
+  public void installDefaults(AbstractButton button)
+  {
+    super.installDefaults(button);
+
+    UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+    button.setFont(defaults.getFont("Button.font"));
+
+    if (button.getParent() instanceof JToolBar)
+      button.setBorder(MetalBorders.getToolbarButtonBorder());
+  }
+
+}
===================================================================
Checking out kaffe/libraries/javalib/javax/swing/plaf/metal/MetalCheckBoxUI.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/javax/swing/plaf/metal/MetalCheckBoxUI.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/javax/swing/plaf/metal/MetalCheckBoxUI.java	Tue Apr 19 18:49:41 2005
@@ -0,0 +1,74 @@
+/* MetalCheckBoxUI.java
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import javax.swing.JComponent;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicCheckBoxUI;
+
+public class MetalCheckBoxUI
+  extends BasicCheckBoxUI
+{
+
+  // FIXME: maybe replace by a Map of instances when this becomes stateful
+  /** The shared UI instance for JCheckBoxes. */
+  private static MetalCheckBoxUI instance = null;
+
+  /**
+   * Constructs a new instance of MetalCheckBoxUI.
+   */
+  public MetalCheckBoxUI()
+  {
+    super();
+  }
+
+  /**
+   * Returns an instance of MetalCheckBoxUI.
+   *
+   * @param component the component for which we return an UI instance
+   *
+   * @return an instance of MetalCheckBoxUI
+   */
+  public static ComponentUI createUI(JComponent component)
+  {
+    if (instance == null)
+      instance = new MetalCheckBoxUI();
+    return instance;
+  }
+}
===================================================================
Checking out kaffe/libraries/javalib/javax/swing/plaf/metal/MetalComboBoxUI.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/javax/swing/plaf/metal/MetalComboBoxUI.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/javax/swing/plaf/metal/MetalComboBoxUI.java	Tue Apr 19 18:49:41 2005
@@ -0,0 +1,74 @@
+/* MetalComboBoxUI.java
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import javax.swing.JComponent;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicComboBoxUI;
+
+public class MetalComboBoxUI
+  extends BasicComboBoxUI
+{
+
+  // FIXME: maybe replace by a Map of instances when this becomes stateful
+  /** The shared UI instance for JComboBoxes. */
+  private static MetalComboBoxUI instance = null;
+
+  /**
+   * Constructs a new instance of MetalComboBoxUI.
+   */
+  public MetalComboBoxUI()
+  {
+    super();
+  }
+
+  /**
+   * Returns an instance of MetalComboBoxUI.
+   *
+   * @param component the component for which we return an UI instance
+   *
+   * @return an instance of MetalComboBoxUI
+   */
+  public static ComponentUI createUI(JComponent component)
+  {
+    if (instance == null)
+      instance = new MetalComboBoxUI();
+    return instance;
+  }
+}
===================================================================
Checking out kaffe/libraries/javalib/javax/swing/plaf/metal/MetalDesktopIconUI.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/javax/swing/plaf/metal/MetalDesktopIconUI.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/javax/swing/plaf/metal/MetalDesktopIconUI.java	Tue Apr 19 18:49:41 2005
@@ -0,0 +1,74 @@
+/* MetalDesktopIconUI.java
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+

*** Patch too long, truncated ***




More information about the kaffe mailing list