summaryrefslogtreecommitdiff
path: root/libjava/java/awt/SystemColor.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2002-01-22 22:03:04 +0000
committerTom Tromey <tromey@gcc.gnu.org>2002-01-22 22:03:04 +0000
commitbda145054363dfa5eef640d526542bc6130a56d0 (patch)
tree317e29ad09d5c7d11f21d6999c1e4c2d70eb6650 /libjava/java/awt/SystemColor.java
parente3b0efd1eeea460b091c1b9b9038605a672b1cb9 (diff)
ButtonPeer.java: Replace with Classpath version.
* java/awt/peer/ButtonPeer.java: Replace with Classpath version. * java/awt/peer/CanvasPeer.java: Replace with Classpath version. * java/awt/peer/CheckboxMenuItemPeer.java: Replace with Classpath version. * java/awt/peer/CheckboxPeer.java: Replace with Classpath version. * java/awt/peer/ChoicePeer.java: Replace with Classpath version. * java/awt/peer/ComponentPeer.java: Replace with Classpath version. * java/awt/peer/ContainerPeer.java: Replace with Classpath version. * java/awt/peer/DialogPeer.java: Replace with Classpath version. * java/awt/peer/FileDialogPeer.java: Replace with Classpath version. * java/awt/peer/FontPeer.java: Replace with Classpath version. * java/awt/peer/FramePeer.java: Replace with Classpath version. * java/awt/peer/LabelPeer.java: Replace with Classpath version. * java/awt/peer/LightweightPeer.java: Replace with Classpath version. * java/awt/peer/ListPeer.java: Replace with Classpath version. * java/awt/peer/MenuBarPeer.java: Replace with Classpath version. * java/awt/peer/MenuComponentPeer.java: Replace with Classpath version. * java/awt/peer/MenuItemPeer.java: Replace with Classpath version. * java/awt/peer/MenuPeer.java: Replace with Classpath version. * java/awt/peer/PanelPeer.java: Replace with Classpath version. * java/awt/peer/PopupMenuPeer.java: Replace with Classpath version. * java/awt/peer/ScrollPanePeer.java: Replace with Classpath version. * java/awt/peer/ScrollbarPeer.java: Replace with Classpath version. * java/awt/peer/TextAreaPeer.java: Replace with Classpath version. * java/awt/peer/TextComponentPeer.java: Replace with Classpath version. * java/awt/peer/TextFieldPeer.java: Replace with Classpath version. * java/awt/peer/WindowPeer.java: Replace with Classpath version. * gnu/awt/xlib/XPanelPeer.java (insets): New method. * gnu/awt/xlib/XCanvasPeer.java (show, hide): New methods. (minimumSize, preferredSize, reshape): Likewise. * gnu/awt/xlib/XFramePeer.java (insets, enable, disable, getColorModel): New methods. * java/awt/PopupMenu.java: Merged with Classpath. * java/awt/MenuBar.java: Merged with Classpath. * java/awt/SystemColor.java: Replace with Classpath version. * java/awt/Panel.java: Merged with Classpath. * java/awt/PaintContext.java: Updated copyright. * java/awt/MenuShortcut.java: Merged with Classpath. * java/awt/MenuContainer.java: Merged with Classpath. * java/awt/Menu.java: Merged with Classpath. * java/awt/MediaEntry.java: New file from Classpath. * java/awt/MediaTracker.java: New file from Classpath. * java/awt/List.java: Merged with Classpath version. * java/awt/Insets.java: Merged with Classpath version. * java/awt/ImageMediaEntry.java: New file from Classpath. * java/awt/Image.java: Replaced with Classpath version. * java/awt/FontMetrics.java: Merged with Classpath version. * java/awt/Cursor.java (getDefaultCursor): Use DEFAULT_CURSOR constant. * java/awt/Font.java: Merged with Classpath version. * java/awt/Dialog.java: Merged with Classpath version. * java/awt/Color.java: Merged with Classpath version. * java/awt/Choice.java: Merged with Classpath version. * java/awt/CheckboxMenuItem.java: Merged with Classpath version. * java/awt/Adjustable.java: Replace with Classpath version. * java/awt/MenuItem.java (paramString): Don't include class name or brackets. Call superclass paramString. * java/awt/MenuComponent.java (toString): Call paramString. (paramString): Compute string; don't call toString. * java/awt/Label.java (paramString): Don't include class name or brackets. Call superclass paramString. * java/awt/Checkbox.java (paramString): Don't include class name or brackets. Call superclass paramString. * java/awt/Button.java (paramString): Don't include class name or brackets. Call superclass paramString. * java/awt/MenuComponent.java (getTreeLock): Now protected. From-SVN: r49099
Diffstat (limited to 'libjava/java/awt/SystemColor.java')
-rw-r--r--libjava/java/awt/SystemColor.java561
1 files changed, 411 insertions, 150 deletions
diff --git a/libjava/java/awt/SystemColor.java b/libjava/java/awt/SystemColor.java
index 0a77d0575ad..ebe2ee2e48c 100644
--- a/libjava/java/awt/SystemColor.java
+++ b/libjava/java/awt/SystemColor.java
@@ -1,158 +1,419 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* SystemColor.java -- Class to access system color values.
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+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.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
-/** This class contains most of the colors used by the native
- * windowing sytem to draw native components.
- * @author Tom Tromey <tromey@redhat.com>
- * @date December 25, 2000
- */
+/**
+ * This class contains the various "system colors" in use by the
+ * native windowing system.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public final class SystemColor extends Color implements java.io.Serializable
{
- /** The background color for the title bar of an active window. */
- public static final SystemColor activeCaption
- = new SystemColor (ACTIVE_CAPTION);
- /** The border color of an active window. */
- public static final SystemColor activeCaptionBorder
- = new SystemColor (ACTIVE_CAPTION_BORDER);
- /** The color of text in the title bar of an active window. */
- public static final SystemColor activeCaptionText
- = new SystemColor (ACTIVE_CAPTION_TEXT);
- /** The background color. */
- public static final SystemColor control = new SystemColor (CONTROL);
- /** The darkest color of an outline. */
- public static final SystemColor controlDkShadow
- = new SystemColor (CONTROL_DK_SHADOW);
- /** The second brightest color of an outline. */
- public static final SystemColor controlHighlight
- = new SystemColor (CONTROL_HIGHLIGHT);
- /** The brightest color of an outline. */
- public static final SystemColor controlLtHighlight
- = new SystemColor (CONTROL_LT_HIGHLIGHT);
- /** The second darkest color of an outline. */
- public static final SystemColor controlShadow
- = new SystemColor (CONTROL_SHADOW);
- /** The color of text in a label. */
- public static final SystemColor controlText = new SystemColor (CONTROL_TEXT);
- /** The background color of the desktop. */
- public static final SystemColor desktop = new SystemColor (DESKTOP);
- /** The background color for the title bar of an inactive window. */
- public static final SystemColor inactiveCaption
- = new SystemColor (INACTIVE_CAPTION);
- /** The border color of an inactive window. */
- public static final SystemColor inactiveCaptionBorder
- = new SystemColor (INACTIVE_CAPTION_BORDER);
- /** The color of text in the title ar of an inactive window. */
- public static final SystemColor inactiveCaptionText
- = new SystemColor (INACTIVE_CAPTION_TEXT);
- /** The background color of tooltips. */
- public static final SystemColor info = new SystemColor (INFO);
- /** The color of text in tooltips. */
- public static final SystemColor infoText = new SystemColor (INFO_TEXT);
- /** The background color of a menu. */
- public static final SystemColor menu = new SystemColor (MENU);
- /** The color of text in a menu. */
- public static final SystemColor menuText = new SystemColor (MENU_TEXT);
- /** The background color of a scrollbar. */
- public static final SystemColor scrollbar = new SystemColor (SCROLLBAR);
- /** The background color of text components. */
- public static final SystemColor text = new SystemColor (TEXT);
- /** The background color of highlighted text. */
- public static final SystemColor textHighlight
- = new SystemColor (TEXT_HIGHLIGHT);
- /** The color of highlighted text. */
- public static final SystemColor textHighlightText
- = new SystemColor (TEXT_HIGHLIGHT_TEXT);
- /** The color of inactive text. */
- public static final SystemColor textInactiveText
- = new SystemColor (TEXT_INACTIVE_TEXT);
- /** The color of text in text components. */
- public static final SystemColor textText = new SystemColor (TEXT_TEXT);
- /** The background color of a window. */
- public static final SystemColor window = new SystemColor (WINDOW);
- /** The border color of a window. */
- public static final SystemColor windowBorder
- = new SystemColor (WINDOW_BORDER);
- /** The color of text in a window. */
- public static final SystemColor windowText = new SystemColor (WINDOW_TEXT);
-
- public static final int DESKTOP = 0;
- public static final int ACTIVE_CAPTION = 1;
- public static final int ACTIVE_CAPTION_TEXT = 2;
- public static final int ACTIVE_CAPTION_BORDER = 3;
- public static final int INACTIVE_CAPTION = 4;
- public static final int INACTIVE_CAPTION_TEXT = 5;
- public static final int INACTIVE_CAPTION_BORDER = 6;
- public static final int WINDOW = 7;
- public static final int WINDOW_BORDER = 8;
- public static final int WINDOW_TEXT = 9;
- public static final int MENU = 10;
- public static final int MENU_TEXT = 11;
- public static final int TEXT = 12;
- public static final int TEXT_TEXT = 13;
- public static final int TEXT_HIGHLIGHT = 14;
- public static final int TEXT_HIGHLIGHT_TEXT = 15;
- public static final int TEXT_INACTIVE_TEXT = 16;
- public static final int CONTROL = 17;
- public static final int CONTROL_TEXT = 18;
- public static final int CONTROL_HIGHLIGHT = 19;
- public static final int CONTROL_LT_HIGHLIGHT = 20;
- public static final int CONTROL_SHADOW = 21;
- public static final int CONTROL_DK_SHADOW = 22;
- public static final int SCROLLBAR = 23;
- public static final int INFO = 24;
- public static final int INFO_TEXT = 25;
-
- public static final int NUM_COLORS = 26;
-
- private static final int rgbs[] =
- {
- 0x005c5c,
- 0x000080,
- 0xffffff,
- 0xc0c0c0,
- 0x808080,
- 0xc0c0c0,
- 0xc0c0c0,
- 0xffffff,
- 0x000000,
- 0x000000,
- 0xc0c0c0,
- 0x000000,
- 0xc0c0c0,
- 0x000000,
- 0x000080,
- 0xffffff,
- 0x808080,
- 0xc0c0c0,
- 0x000000,
- 0xffffff,
- 0xe0e0e0,
- 0x808080,
- 0x000000,
- 0xe0e0e0,
- 0xe0e000,
- 0x000000
- };
-
- public int getRGB ()
- {
- return rgbs[rgba];
- }
-
- public String toString ()
- {
- return "[" + getClass ().getName () + " " + rgba + "]";
- }
-
- private SystemColor (int index)
- {
- super (index, true);
- }
+
+/*
+ * Static Variables
+ */
+
+/**
+ * Array index of the desktop color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int DESKTOP = 0;
+
+/**
+ * Array index of the active caption color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int ACTIVE_CAPTION = 1;
+
+/**
+ * Array index of the active caption text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int ACTIVE_CAPTION_TEXT = 2;
+
+/**
+ * Array index of the active caption border color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int ACTIVE_CAPTION_BORDER = 3;
+
+/**
+ * Array index of the inactive caption color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INACTIVE_CAPTION = 4;
+
+/**
+ * Array index of the inactive caption text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INACTIVE_CAPTION_TEXT = 5;
+
+/**
+ * Array index of the inactive caption border color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INACTIVE_CAPTION_BORDER = 6;
+
+/**
+ * Array index of the window background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int WINDOW = 7;
+
+/**
+ * Array index of the window border color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int WINDOW_BORDER = 8;
+
+/**
+ * Array index of the window text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int WINDOW_TEXT = 9;
+
+/**
+ * Array index of the menu background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int MENU = 10;
+
+/**
+ * Array index of the menu text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int MENU_TEXT = 11;
+
+/**
+ * Array index of the text background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT = 12;
+
+/**
+ * Array index of the text foreground color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT_TEXT = 13;
+
+/**
+ * Array index of the highlighted text background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT_HIGHLIGHT = 14;
+
+/**
+ * Array index of the highlighted text foreground color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT_HIGHLIGHT_TEXT = 15;
+
+/**
+ * Array index of the inactive text foreground color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT_INACTIVE_TEXT = 16;
+
+/**
+ * Array index of the control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL = 17;
+
+/**
+ * Array index of the control text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_TEXT = 18;
+
+/**
+ * Array index of the highlighted control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_HIGHLIGHT = 19;
+
+/**
+ * Array index of the lightly highlighted control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_LT_HIGHLIGHT = 20;
+
+/**
+ * Array index of the shadowed control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_SHADOW = 21;
+
+/**
+ * Array index of the darkly shadowed control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_DK_SHADOW = 22;
+
+/**
+ * Array index of the scrollbar background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int SCROLLBAR = 23;
+
+/**
+ * Array index of the info background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INFO = 24;
+
+/**
+ * Array index of the info text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INFO_TEXT = 25;
+
+/**
+ * The number of system colors. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int NUM_COLORS = 26;
+
+/**
+ * The desktop color.
+ */
+public static final SystemColor desktop;
+
+/**
+ * The active caption background color.
+ */
+public static final SystemColor activeCaption;
+
+/**
+ * The active caption text color.
+ */
+public static final SystemColor activeCaptionText;
+
+/**
+ * The active caption border color.
+ */
+public static final SystemColor activeCaptionBorder;
+
+/**
+ * The inactive caption background color.
+ */
+public static final SystemColor inactiveCaption;
+
+/**
+ * The inactive caption text color.
+ */
+public static final SystemColor inactiveCaptionText;
+
+/**
+ * The inactive caption border color.
+ */
+public static final SystemColor inactiveCaptionBorder;
+
+/**
+ * The window background color.
+ */
+public static final SystemColor window;
+
+/**
+ * The window border color.
+ */
+public static final SystemColor windowBorder;
+
+/**
+ * The window text color.
+ */
+public static final SystemColor windowText;
+
+/**
+ * The menu background color.
+ */
+public static final SystemColor menu;
+
+/**
+ * The menu text color.
+ */
+public static final SystemColor menuText;
+
+/**
+ * The text background color.
+ */
+public static final SystemColor text;
+
+/**
+ * The text foreground color.
+ */
+public static final SystemColor textText;
+
+/**
+ * The highlighted text background color.
+ */
+public static final SystemColor textHighlight;
+
+/**
+ * The highlighted text foreground color.
+ */
+public static final SystemColor textHighlightText;
+
+/**
+ * The inactive text color.
+ */
+public static final SystemColor textInactiveText;
+
+/**
+ * The control background color.
+ */
+public static final SystemColor control;
+
+/**
+ * The control text color.
+ */
+public static final SystemColor controlText;
+
+/**
+ * The control highlight color.
+ */
+public static final SystemColor controlHighlight;
+
+/**
+ * The control light highlight color.
+ */
+public static final SystemColor controlLtHighlight;
+
+/**
+ * The control shadow color.
+ */
+public static final SystemColor controlShadow;
+
+/**
+ * The control dark shadow color.
+ */
+public static final SystemColor controlDkShadow;
+
+/**
+ * The scrollbar color.
+ */
+public static final SystemColor scrollbar;
+
+/**
+ * The info text background color.
+ */
+public static final SystemColor info;
+
+/**
+ * The info text foreground color.
+ */
+public static final SystemColor infoText;
+
+// Serialization version constant
+private static final long serialVersionUID = 4503142729533789064L;
+
+static
+{
+ int[] sys_color_rgbs = new int[NUM_COLORS];
+ Toolkit.getDefaultToolkit().loadSystemColors(sys_color_rgbs);
+
+ desktop = new SystemColor(sys_color_rgbs[DESKTOP]);
+ activeCaption= new SystemColor(sys_color_rgbs[ACTIVE_CAPTION]);
+ activeCaptionText= new SystemColor(sys_color_rgbs[ACTIVE_CAPTION_TEXT]);
+ activeCaptionBorder = new SystemColor(sys_color_rgbs[ACTIVE_CAPTION_BORDER]);
+ inactiveCaption = new SystemColor(sys_color_rgbs[INACTIVE_CAPTION]);
+ inactiveCaptionText = new SystemColor(sys_color_rgbs[INACTIVE_CAPTION_TEXT]);
+ inactiveCaptionBorder =
+ new SystemColor(sys_color_rgbs[INACTIVE_CAPTION_BORDER]);
+ window = new SystemColor(sys_color_rgbs[WINDOW]);
+ windowBorder = new SystemColor(sys_color_rgbs[WINDOW_BORDER]);
+ windowText = new SystemColor(sys_color_rgbs[WINDOW_TEXT]);
+ menu = new SystemColor(sys_color_rgbs[MENU]);
+ menuText = new SystemColor(sys_color_rgbs[MENU_TEXT]);
+ text = new SystemColor(sys_color_rgbs[TEXT]);
+ textText = new SystemColor(sys_color_rgbs[TEXT_TEXT]);
+ textHighlight = new SystemColor(sys_color_rgbs[TEXT_HIGHLIGHT]);
+ textHighlightText = new SystemColor(sys_color_rgbs[TEXT_HIGHLIGHT_TEXT]);
+ textInactiveText = new SystemColor(sys_color_rgbs[TEXT_INACTIVE_TEXT]);
+ control = new SystemColor(sys_color_rgbs[CONTROL]);
+ controlText = new SystemColor(sys_color_rgbs[CONTROL_TEXT]);
+ controlHighlight = new SystemColor(sys_color_rgbs[CONTROL_HIGHLIGHT]);
+ controlLtHighlight = new SystemColor(sys_color_rgbs[CONTROL_LT_HIGHLIGHT]);
+ controlShadow = new SystemColor(sys_color_rgbs[CONTROL_SHADOW]);
+ controlDkShadow = new SystemColor(sys_color_rgbs[CONTROL_DK_SHADOW]);
+ scrollbar = new SystemColor(sys_color_rgbs[SCROLLBAR]);
+ info = new SystemColor(sys_color_rgbs[INFO]);
+ infoText = new SystemColor(sys_color_rgbs[INFO_TEXT]);
+}
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+private
+SystemColor(int rgb)
+{
+ super(rgb);
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the RGB value for this color as an <code>int</code>. The first
+ * byte is the blue value, the second the green value, the third the
+ * red value and the fourth is set to 0xFF.
+ *
+ * @return The RGB value.
+ */
+public int
+getRGB()
+{
+ // Override only to be spec consistent.
+ return(super.getRGB());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a string describing this color.
+ *
+ * @return A string describing this color.
+ */
+public String
+toString()
+{
+ return("SystemColor(R=" + getRed() + ",G=" + getGreen() + ",B=" +
+ getBlue() + ")");
}
+
+} // class SystemColor
+