feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,167 @@
/*
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
import javax.swing.plaf.synth.ColorType;
import java.awt.Color;
import javax.swing.plaf.ColorUIResource;
/**
* @author Scott Violet
*/
public class GTKColorType extends ColorType {
// GTK allows you to specify the foreground and background in a
// gtkrc, the rest (dark, mid, light) are calculated from these
// values.
public static final ColorType LIGHT = new GTKColorType("Light");
public static final ColorType DARK = new GTKColorType("Dark");
public static final ColorType MID = new GTKColorType("Mid");
public static final ColorType BLACK = new GTKColorType("Black");
public static final ColorType WHITE = new GTKColorType("White");
public static final int MAX_COUNT;
private static final float[] HLS_COLORS = new float[3];
private static final Object HLS_COLOR_LOCK = new Object();
static {
MAX_COUNT = WHITE.getID() + 1;
}
private static int hlsToRGB(float h, float l, float s) {
float m2 = (l <= .5f) ? (l * (1 + s)) : (l + s - l * s);
float m1 = 2.0f * l - m2;
float r, g, b;
if (s == 0.0) {
if (h == 0.0) {
r = g = b = l;
}
else {
r = g = b = 0;
}
}
else {
r = hlsValue(m1, m2, h + 120);
g = hlsValue(m1, m2, h);
b = hlsValue(m1, m2, h - 120);
}
return (((int)(r * 255)) << 16) | (((int)(g * 255.0)) << 8) |
((int)(b * 255));
}
private static float hlsValue(float n1, float n2, float h) {
if (h > 360) {
h -= 360;
}
else if (h < 0) {
h += 360;
}
if (h < 60) {
return n1 + (n2 - n1) * h / 60.0f;
}
else if (h < 180) {
return n2;
}
else if (h < 240) {
return n1 + (n2 - n1) * (240.0f - h) / 60.0f;
}
return n1;
}
/**
* Converts from RGB color space to HLS colorspace.
*/
private static float[] rgbToHLS(int rgb, float[] hls) {
float r = ((rgb & 0xFF0000) >> 16) / 255.0f;
float g = ((rgb & 0xFF00) >> 8) / 255.0f;
float b = (rgb & 0xFF) / 255.0f;
/* calculate lightness */
float max = Math.max(Math.max(r, g), b);
float min = Math.min(Math.min(r, g), b);
float l = (max + min) / 2.0f;
float s = 0;
float h = 0;
if (max != min) {
float delta = max - min;
s = (l <= .5f) ? (delta / (max + min)) : (delta / (2.0f - max -min));
if (r == max) {
h = (g - b) / delta;
}
else if (g == max) {
h = 2.0f + (b - r) / delta;
}
else {
h = 4.0f + (r - g) / delta;
}
h *= 60.0f;
if (h < 0) {
h += 360.0f;
}
}
if (hls == null) {
hls = new float[3];
}
hls[0] = h;
hls[1] = l;
hls[2] = s;
return hls;
}
/**
* Creates and returns a new color derived from the passed in color.
* The transformation is done in the HLS color space using the specified
* arguments to scale.
*
* @param color Color to alter
* @param hFactory Amount to scale the hue
* @param lFactor Amount to scale the lightness
* @param sFactory Amount to sacle saturation
* @return newly created color
*/
static Color adjustColor(Color color, float hFactor, float lFactor,
float sFactor) {
float h;
float l;
float s;
synchronized(HLS_COLOR_LOCK) {
float[] hls = rgbToHLS(color.getRGB(), HLS_COLORS);
h = hls[0];
l = hls[1];
s = hls[2];
}
h = Math.min(360, hFactor * h);
l = Math.min(1, lFactor * l);
s = Math.min(1, sFactor * s);
return new ColorUIResource(hlsToRGB(h, l, s));
}
protected GTKColorType(String name) {
super(name);
}
}

View File

@@ -0,0 +1,118 @@
/*
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
/**
* @author Scott Violet
*/
public interface GTKConstants {
/**
* Used to indicate a constant is not defined.
*/
public static final int UNDEFINED = -100;
/**
* Java representation of native GtkIconSize enum
*/
public enum IconSize {
INVALID,
MENU,
SMALL_TOOLBAR,
LARGE_TOOLBAR,
BUTTON,
DND,
DIALOG
}
/**
* Java representation of native GtkTextDirection enum
*/
public enum TextDirection {
NONE,
LTR,
RTL
}
/**
* Java representation of native GtkShadowType enum
*/
public enum ShadowType {
NONE,
IN,
OUT,
ETCHED_IN,
ETCHED_OUT
}
/**
* Java representation of native GtkStateType enum
*/
public enum StateType {
NORMAL,
ACTIVE,
PRELIGHT,
SELECTED,
INSENSITIVE
}
/**
* Java representation of native GtkExpanderStyle enum
*/
public enum ExpanderStyle {
COLLAPSED,
SEMI_COLLAPSED,
SEMI_EXPANDED,
EXPANDED,
}
/**
* Java representation of native GtkPositionType enum
*/
public enum PositionType {
LEFT,
RIGHT,
TOP,
BOTTOM
}
/**
* Java representation of native GtkArrowType enum
*/
public enum ArrowType {
UP,
DOWN,
LEFT,
RIGHT
}
/**
* Java representation of native GtkOrientation enum
*/
public enum Orientation {
HORIZONTAL,
VERTICAL
}
}

View File

@@ -0,0 +1,646 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
import java.awt.*;
import java.awt.image.*;
import java.util.HashMap;
import javax.swing.*;
import javax.swing.plaf.synth.*;
import com.sun.java.swing.plaf.gtk.GTKConstants.ArrowType;
import com.sun.java.swing.plaf.gtk.GTKConstants.ExpanderStyle;
import com.sun.java.swing.plaf.gtk.GTKConstants.Orientation;
import com.sun.java.swing.plaf.gtk.GTKConstants.PositionType;
import com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType;
import com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection;
import sun.awt.image.SunWritableRaster;
import sun.swing.ImageCache;
/**
* GTKEngine delegates all painting job to native GTK libraries.
*
* Painting with GTKEngine looks like this:
* First, startPainting() is called. It prepares an offscreen buffer of the
* required size.
* Then, any number of paintXXX() methods can be called. They effectively ignore
* the Graphics parameter and draw to the offscreen buffer.
* Finally, finishPainting() should be called. It fills the data buffer passed
* in with the image data.
*
* @author Josh Outwater
*/
class GTKEngine {
final static GTKEngine INSTANCE = new GTKEngine();
/** Size of the image cache */
private static final int CACHE_SIZE = 50;
/** This enum mirrors that in gtk2_interface.h */
static enum WidgetType {
BUTTON, CHECK_BOX, CHECK_BOX_MENU_ITEM, COLOR_CHOOSER,
COMBO_BOX, COMBO_BOX_ARROW_BUTTON, COMBO_BOX_TEXT_FIELD,
DESKTOP_ICON, DESKTOP_PANE, EDITOR_PANE, FORMATTED_TEXT_FIELD,
HANDLE_BOX, HPROGRESS_BAR,
HSCROLL_BAR, HSCROLL_BAR_BUTTON_LEFT, HSCROLL_BAR_BUTTON_RIGHT,
HSCROLL_BAR_TRACK, HSCROLL_BAR_THUMB,
HSEPARATOR, HSLIDER, HSLIDER_TRACK, HSLIDER_THUMB, HSPLIT_PANE_DIVIDER,
INTERNAL_FRAME, INTERNAL_FRAME_TITLE_PANE, IMAGE, LABEL, LIST, MENU,
MENU_BAR, MENU_ITEM, MENU_ITEM_ACCELERATOR, OPTION_PANE, PANEL,
PASSWORD_FIELD, POPUP_MENU, POPUP_MENU_SEPARATOR,
RADIO_BUTTON, RADIO_BUTTON_MENU_ITEM, ROOT_PANE, SCROLL_PANE,
SPINNER, SPINNER_ARROW_BUTTON, SPINNER_TEXT_FIELD,
SPLIT_PANE, TABBED_PANE, TABBED_PANE_TAB_AREA, TABBED_PANE_CONTENT,
TABBED_PANE_TAB, TABLE, TABLE_HEADER, TEXT_AREA, TEXT_FIELD, TEXT_PANE,
TITLED_BORDER,
TOGGLE_BUTTON, TOOL_BAR, TOOL_BAR_DRAG_WINDOW, TOOL_BAR_SEPARATOR,
TOOL_TIP, TREE, TREE_CELL, VIEWPORT, VPROGRESS_BAR,
VSCROLL_BAR, VSCROLL_BAR_BUTTON_UP, VSCROLL_BAR_BUTTON_DOWN,
VSCROLL_BAR_TRACK, VSCROLL_BAR_THUMB,
VSEPARATOR, VSLIDER, VSLIDER_TRACK, VSLIDER_THUMB,
VSPLIT_PANE_DIVIDER
}
/**
* Representation of GtkSettings properties.
* When we need more settings we can add them here and
* to all implementations of getGTKSetting().
*/
static enum Settings {
GTK_FONT_NAME,
GTK_ICON_SIZES,
GTK_CURSOR_BLINK,
GTK_CURSOR_BLINK_TIME
}
/* Custom regions are needed for representing regions that don't exist
* in the original Region class.
*/
static class CustomRegion extends Region {
/*
* TITLED_BORDER Region is mapped to GtkFrame class which can draw
* titled borders around components.
*/
static Region TITLED_BORDER = new CustomRegion("TitledBorder");
private CustomRegion(String name) {
super(name, null, false);
}
}
private static HashMap<Region, Object> regionToWidgetTypeMap;
private ImageCache cache = new ImageCache(CACHE_SIZE);
private int x0, y0, w0, h0;
private Graphics graphics;
private Object[] cacheArgs;
private native void native_paint_arrow(
int widgetType, int state, int shadowType, String detail,
int x, int y, int width, int height, int arrowType);
private native void native_paint_box(
int widgetType, int state, int shadowType, String detail,
int x, int y, int width, int height, int synthState, int dir);
private native void native_paint_box_gap(
int widgetType, int state, int shadowType, String detail,
int x, int y, int width, int height,
int gapSide, int gapX, int gapWidth);
private native void native_paint_check(
int widgetType, int synthState, String detail,
int x, int y, int width, int height);
private native void native_paint_expander(
int widgetType, int state, String detail,
int x, int y, int width, int height, int expanderStyle);
private native void native_paint_extension(
int widgetType, int state, int shadowType, String detail,
int x, int y, int width, int height, int placement);
private native void native_paint_flat_box(
int widgetType, int state, int shadowType, String detail,
int x, int y, int width, int height, boolean hasFocus);
private native void native_paint_focus(
int widgetType, int state, String detail,
int x, int y, int width, int height);
private native void native_paint_handle(
int widgetType, int state, int shadowType, String detail,
int x, int y, int width, int height, int orientation);
private native void native_paint_hline(
int widgetType, int state, String detail,
int x, int y, int width, int height);
private native void native_paint_option(
int widgetType, int synthState, String detail,
int x, int y, int width, int height);
private native void native_paint_shadow(
int widgetType, int state, int shadowType, String detail,
int x, int y, int width, int height, int synthState, int dir);
private native void native_paint_slider(
int widgetType, int state, int shadowType, String detail, int x,
int y, int width, int height, int orientation, boolean hasFocus);
private native void native_paint_vline(
int widgetType, int state, String detail,
int x, int y, int width, int height);
private native void native_paint_background(
int widgetType, int state, int x, int y, int width, int height);
private native Object native_get_gtk_setting(int property);
private native void nativeSetRangeValue(int widgetType, double value,
double min, double max,
double visible);
private native void nativeStartPainting(int w, int h);
private native int nativeFinishPainting(int[] buffer, int width, int height);
private native void native_switch_theme();
static {
// Make sure the awt toolkit is loaded so we have access to native
// methods.
Toolkit.getDefaultToolkit();
// Initialize regionToWidgetTypeMap
regionToWidgetTypeMap = new HashMap<Region, Object>(50);
regionToWidgetTypeMap.put(Region.ARROW_BUTTON, new WidgetType[] {
WidgetType.SPINNER_ARROW_BUTTON,
WidgetType.COMBO_BOX_ARROW_BUTTON,
WidgetType.HSCROLL_BAR_BUTTON_LEFT,
WidgetType.HSCROLL_BAR_BUTTON_RIGHT,
WidgetType.VSCROLL_BAR_BUTTON_UP,
WidgetType.VSCROLL_BAR_BUTTON_DOWN});
regionToWidgetTypeMap.put(Region.BUTTON, WidgetType.BUTTON);
regionToWidgetTypeMap.put(Region.CHECK_BOX, WidgetType.CHECK_BOX);
regionToWidgetTypeMap.put(Region.CHECK_BOX_MENU_ITEM,
WidgetType.CHECK_BOX_MENU_ITEM);
regionToWidgetTypeMap.put(Region.COLOR_CHOOSER, WidgetType.COLOR_CHOOSER);
regionToWidgetTypeMap.put(Region.FILE_CHOOSER, WidgetType.OPTION_PANE);
regionToWidgetTypeMap.put(Region.COMBO_BOX, WidgetType.COMBO_BOX);
regionToWidgetTypeMap.put(Region.DESKTOP_ICON, WidgetType.DESKTOP_ICON);
regionToWidgetTypeMap.put(Region.DESKTOP_PANE, WidgetType.DESKTOP_PANE);
regionToWidgetTypeMap.put(Region.EDITOR_PANE, WidgetType.EDITOR_PANE);
regionToWidgetTypeMap.put(Region.FORMATTED_TEXT_FIELD, new WidgetType[] {
WidgetType.FORMATTED_TEXT_FIELD, WidgetType.SPINNER_TEXT_FIELD});
regionToWidgetTypeMap.put(GTKRegion.HANDLE_BOX, WidgetType.HANDLE_BOX);
regionToWidgetTypeMap.put(Region.INTERNAL_FRAME,
WidgetType.INTERNAL_FRAME);
regionToWidgetTypeMap.put(Region.INTERNAL_FRAME_TITLE_PANE,
WidgetType.INTERNAL_FRAME_TITLE_PANE);
regionToWidgetTypeMap.put(Region.LABEL, new WidgetType[] {
WidgetType.LABEL, WidgetType.COMBO_BOX_TEXT_FIELD});
regionToWidgetTypeMap.put(Region.LIST, WidgetType.LIST);
regionToWidgetTypeMap.put(Region.MENU, WidgetType.MENU);
regionToWidgetTypeMap.put(Region.MENU_BAR, WidgetType.MENU_BAR);
regionToWidgetTypeMap.put(Region.MENU_ITEM, WidgetType.MENU_ITEM);
regionToWidgetTypeMap.put(Region.MENU_ITEM_ACCELERATOR,
WidgetType.MENU_ITEM_ACCELERATOR);
regionToWidgetTypeMap.put(Region.OPTION_PANE, WidgetType.OPTION_PANE);
regionToWidgetTypeMap.put(Region.PANEL, WidgetType.PANEL);
regionToWidgetTypeMap.put(Region.PASSWORD_FIELD,
WidgetType.PASSWORD_FIELD);
regionToWidgetTypeMap.put(Region.POPUP_MENU, WidgetType.POPUP_MENU);
regionToWidgetTypeMap.put(Region.POPUP_MENU_SEPARATOR,
WidgetType.POPUP_MENU_SEPARATOR);
regionToWidgetTypeMap.put(Region.PROGRESS_BAR, new WidgetType[] {
WidgetType.HPROGRESS_BAR, WidgetType.VPROGRESS_BAR});
regionToWidgetTypeMap.put(Region.RADIO_BUTTON, WidgetType.RADIO_BUTTON);
regionToWidgetTypeMap.put(Region.RADIO_BUTTON_MENU_ITEM,
WidgetType.RADIO_BUTTON_MENU_ITEM);
regionToWidgetTypeMap.put(Region.ROOT_PANE, WidgetType.ROOT_PANE);
regionToWidgetTypeMap.put(Region.SCROLL_BAR, new WidgetType[] {
WidgetType.HSCROLL_BAR, WidgetType.VSCROLL_BAR});
regionToWidgetTypeMap.put(Region.SCROLL_BAR_THUMB, new WidgetType[] {
WidgetType.HSCROLL_BAR_THUMB, WidgetType.VSCROLL_BAR_THUMB});
regionToWidgetTypeMap.put(Region.SCROLL_BAR_TRACK, new WidgetType[] {
WidgetType.HSCROLL_BAR_TRACK, WidgetType.VSCROLL_BAR_TRACK});
regionToWidgetTypeMap.put(Region.SCROLL_PANE, WidgetType.SCROLL_PANE);
regionToWidgetTypeMap.put(Region.SEPARATOR, new WidgetType[] {
WidgetType.HSEPARATOR, WidgetType.VSEPARATOR});
regionToWidgetTypeMap.put(Region.SLIDER, new WidgetType[] {
WidgetType.HSLIDER, WidgetType.VSLIDER});
regionToWidgetTypeMap.put(Region.SLIDER_THUMB, new WidgetType[] {
WidgetType.HSLIDER_THUMB, WidgetType.VSLIDER_THUMB});
regionToWidgetTypeMap.put(Region.SLIDER_TRACK, new WidgetType[] {
WidgetType.HSLIDER_TRACK, WidgetType.VSLIDER_TRACK});
regionToWidgetTypeMap.put(Region.SPINNER, WidgetType.SPINNER);
regionToWidgetTypeMap.put(Region.SPLIT_PANE, WidgetType.SPLIT_PANE);
regionToWidgetTypeMap.put(Region.SPLIT_PANE_DIVIDER, new WidgetType[] {
WidgetType.HSPLIT_PANE_DIVIDER, WidgetType.VSPLIT_PANE_DIVIDER});
regionToWidgetTypeMap.put(Region.TABBED_PANE, WidgetType.TABBED_PANE);
regionToWidgetTypeMap.put(Region.TABBED_PANE_CONTENT,
WidgetType.TABBED_PANE_CONTENT);
regionToWidgetTypeMap.put(Region.TABBED_PANE_TAB,
WidgetType.TABBED_PANE_TAB);
regionToWidgetTypeMap.put(Region.TABBED_PANE_TAB_AREA,
WidgetType.TABBED_PANE_TAB_AREA);
regionToWidgetTypeMap.put(Region.TABLE, WidgetType.TABLE);
regionToWidgetTypeMap.put(Region.TABLE_HEADER, WidgetType.TABLE_HEADER);
regionToWidgetTypeMap.put(Region.TEXT_AREA, WidgetType.TEXT_AREA);
regionToWidgetTypeMap.put(Region.TEXT_FIELD, new WidgetType[] {
WidgetType.TEXT_FIELD, WidgetType.COMBO_BOX_TEXT_FIELD});
regionToWidgetTypeMap.put(Region.TEXT_PANE, WidgetType.TEXT_PANE);
regionToWidgetTypeMap.put(CustomRegion.TITLED_BORDER, WidgetType.TITLED_BORDER);
regionToWidgetTypeMap.put(Region.TOGGLE_BUTTON, WidgetType.TOGGLE_BUTTON);
regionToWidgetTypeMap.put(Region.TOOL_BAR, WidgetType.TOOL_BAR);
regionToWidgetTypeMap.put(Region.TOOL_BAR_CONTENT, WidgetType.TOOL_BAR);
regionToWidgetTypeMap.put(Region.TOOL_BAR_DRAG_WINDOW,
WidgetType.TOOL_BAR_DRAG_WINDOW);
regionToWidgetTypeMap.put(Region.TOOL_BAR_SEPARATOR,
WidgetType.TOOL_BAR_SEPARATOR);
regionToWidgetTypeMap.put(Region.TOOL_TIP, WidgetType.TOOL_TIP);
regionToWidgetTypeMap.put(Region.TREE, WidgetType.TREE);
regionToWidgetTypeMap.put(Region.TREE_CELL, WidgetType.TREE_CELL);
regionToWidgetTypeMap.put(Region.VIEWPORT, WidgetType.VIEWPORT);
}
/** Translate Region and JComponent into WidgetType ordinals */
static WidgetType getWidgetType(JComponent c, Region id) {
Object value = regionToWidgetTypeMap.get(id);
if (value instanceof WidgetType) {
return (WidgetType)value;
}
WidgetType[] widgets = (WidgetType[])value;
if (c == null ) {
return widgets[0];
}
if (c instanceof JScrollBar) {
return (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) ?
widgets[0] : widgets[1];
} else if (c instanceof JSeparator) {
JSeparator separator = (JSeparator)c;
/* We should return correrct WidgetType if the seperator is inserted
* in Menu/PopupMenu/ToolBar. BugID: 6465603
*/
if (separator.getParent() instanceof JPopupMenu) {
return WidgetType.POPUP_MENU_SEPARATOR;
} else if (separator.getParent() instanceof JToolBar) {
return WidgetType.TOOL_BAR_SEPARATOR;
}
return (separator.getOrientation() == JSeparator.HORIZONTAL) ?
widgets[0] : widgets[1];
} else if (c instanceof JSlider) {
return (((JSlider)c).getOrientation() == JSlider.HORIZONTAL) ?
widgets[0] : widgets[1];
} else if (c instanceof JProgressBar) {
return (((JProgressBar)c).getOrientation() == JProgressBar.HORIZONTAL) ?
widgets[0] : widgets[1];
} else if (c instanceof JSplitPane) {
return (((JSplitPane)c).getOrientation() == JSplitPane.HORIZONTAL_SPLIT) ?
widgets[1] : widgets[0];
} else if (id == Region.LABEL) {
/*
* For all ListCellRenderers we will use COMBO_BOX_TEXT_FIELD widget
* type because we can get correct insets. List items however won't be
* drawn as a text entry (see GTKPainter.paintLabelBackground).
*/
if (c instanceof ListCellRenderer) {
return widgets[1];
} else {
return widgets[0];
}
} else if (id == Region.TEXT_FIELD) {
String name = c.getName();
if (name != null && name.startsWith("ComboBox")) {
return widgets[1];
} else {
return widgets[0];
}
} else if (id == Region.FORMATTED_TEXT_FIELD) {
String name = c.getName();
if (name != null && name.startsWith("Spinner")) {
return widgets[1];
} else {
return widgets[0];
}
} else if (id == Region.ARROW_BUTTON) {
if (c.getParent() instanceof JScrollBar) {
Integer prop = (Integer)
c.getClientProperty("__arrow_direction__");
int dir = (prop != null) ?
prop.intValue() : SwingConstants.WEST;
switch (dir) {
case SwingConstants.WEST:
return WidgetType.HSCROLL_BAR_BUTTON_LEFT;
case SwingConstants.EAST:
return WidgetType.HSCROLL_BAR_BUTTON_RIGHT;
case SwingConstants.NORTH:
return WidgetType.VSCROLL_BAR_BUTTON_UP;
case SwingConstants.SOUTH:
return WidgetType.VSCROLL_BAR_BUTTON_DOWN;
default:
return null;
}
} else if (c.getParent() instanceof JComboBox) {
return WidgetType.COMBO_BOX_ARROW_BUTTON;
} else {
return WidgetType.SPINNER_ARROW_BUTTON;
}
}
return null;
}
private static int getTextDirection(SynthContext context) {
TextDirection dir = TextDirection.NONE;
JComponent comp = context.getComponent();
if (comp != null) {
ComponentOrientation co = comp.getComponentOrientation();
if (co != null) {
dir = co.isLeftToRight() ?
TextDirection.LTR : TextDirection.RTL;
}
}
return dir.ordinal();
}
public void paintArrow(Graphics g, SynthContext context,
Region id, int state, ShadowType shadowType, ArrowType direction,
String detail, int x, int y, int w, int h) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_arrow(widget, state, shadowType.ordinal(),
detail, x - x0, y - y0, w, h, direction.ordinal());
}
public void paintBox(Graphics g, SynthContext context,
Region id, int state, ShadowType shadowType,
String detail, int x, int y, int w, int h) {
int gtkState =
GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int synthState = context.getComponentState();
int dir = getTextDirection(context);
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_box(widget, gtkState, shadowType.ordinal(),
detail, x - x0, y - y0, w, h, synthState, dir);
}
public void paintBoxGap(Graphics g, SynthContext context,
Region id, int state, ShadowType shadowType,
String detail, int x, int y, int w, int h,
PositionType boxGapType, int tabBegin, int size) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_box_gap(widget, state, shadowType.ordinal(), detail,
x - x0, y - y0, w, h, boxGapType.ordinal(), tabBegin, size);
}
public void paintCheck(Graphics g, SynthContext context,
Region id, String detail, int x, int y, int w, int h) {
int synthState = context.getComponentState();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_check(widget, synthState, detail, x - x0, y - y0, w, h);
}
public void paintExpander(Graphics g, SynthContext context,
Region id, int state, ExpanderStyle expanderStyle, String detail,
int x, int y, int w, int h) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_expander(widget, state, detail, x - x0, y - y0, w, h,
expanderStyle.ordinal());
}
public void paintExtension(Graphics g, SynthContext context,
Region id, int state, ShadowType shadowType, String detail,
int x, int y, int w, int h, PositionType placement, int tabIndex) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_extension(widget, state, shadowType.ordinal(), detail,
x - x0, y - y0, w, h, placement.ordinal());
}
public void paintFlatBox(Graphics g, SynthContext context,
Region id, int state, ShadowType shadowType, String detail,
int x, int y, int w, int h, ColorType colorType) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_flat_box(widget, state, shadowType.ordinal(), detail,
x - x0, y - y0, w, h,
context.getComponent().hasFocus());
}
public void paintFocus(Graphics g, SynthContext context,
Region id, int state, String detail, int x, int y, int w, int h) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_focus(widget, state, detail, x - x0, y - y0, w, h);
}
public void paintHandle(Graphics g, SynthContext context,
Region id, int state, ShadowType shadowType, String detail,
int x, int y, int w, int h, Orientation orientation) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_handle(widget, state, shadowType.ordinal(), detail,
x - x0, y - y0, w, h, orientation.ordinal());
}
public void paintHline(Graphics g, SynthContext context,
Region id, int state, String detail, int x, int y, int w, int h) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_hline(widget, state, detail, x - x0, y - y0, w, h);
}
public void paintOption(Graphics g, SynthContext context,
Region id, String detail, int x, int y, int w, int h) {
int synthState = context.getComponentState();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_option(widget, synthState, detail, x - x0, y - y0, w, h);
}
public void paintShadow(Graphics g, SynthContext context,
Region id, int state, ShadowType shadowType, String detail,
int x, int y, int w, int h) {
int gtkState =
GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int synthState = context.getComponentState();
Container parent = context.getComponent().getParent();
if(GTKLookAndFeel.is3()) {
if (parent != null && parent.getParent() instanceof JComboBox) {
if (parent.getParent().hasFocus()) {
synthState |= SynthConstants.FOCUSED;
}
}
}
int dir = getTextDirection(context);
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_shadow(widget, gtkState, shadowType.ordinal(), detail,
x - x0, y - y0, w, h, synthState, dir);
}
public void paintSlider(Graphics g, SynthContext context,
Region id, int state, ShadowType shadowType, String detail, int x,
int y, int w, int h, Orientation orientation, boolean hasFocus) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_slider(widget, state, shadowType.ordinal(), detail,
x - x0, y - y0, w, h, orientation.ordinal(), hasFocus);
}
public void paintVline(Graphics g, SynthContext context,
Region id, int state, String detail, int x, int y, int w, int h) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_vline(widget, state, detail, x - x0, y - y0, w, h);
}
public void paintBackground(Graphics g, SynthContext context,
Region id, int state, Color color, int x, int y, int w, int h) {
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_background(widget, state, x - x0, y - y0, w, h);
}
private final static ColorModel[] COLOR_MODELS = {
// Transparency.OPAQUE
new DirectColorModel(24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000),
// Transparency.BITMASK
new DirectColorModel(25, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x01000000),
// Transparency.TRANSLUCENT
ColorModel.getRGBdefault(),
};
private final static int[][] BAND_OFFSETS = {
{ 0x00ff0000, 0x0000ff00, 0x000000ff }, // OPAQUE
{ 0x00ff0000, 0x0000ff00, 0x000000ff, 0x01000000 }, // BITMASK
{ 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 } // TRANSLUCENT
};
/**
* Paint a cached image identified by its size and a set of additional
* arguments, if there's one.
*
* @return true if a cached image has been painted, false otherwise
*/
public boolean paintCachedImage(Graphics g,
int x, int y, int w, int h, Object... args) {
if (w <= 0 || h <= 0) {
return true;
}
// look for cached image
Image img = cache.getImage(getClass(), null, w, h, args);
if (img != null) {
g.drawImage(img, x, y, null);
return true;
}
return false;
}
/*
* Allocate a native offscreen buffer of the specified size.
*/
public void startPainting(Graphics g,
int x, int y, int w, int h, Object... args) {
nativeStartPainting(w, h);
x0 = x;
y0 = y;
w0 = w;
h0 = h;
graphics = g;
cacheArgs = args;
}
/**
* Convenience method that delegates to finishPainting() with
* caching enabled.
*/
public BufferedImage finishPainting() {
return finishPainting(true);
}
/**
* Called to indicate that painting is finished. We create a new
* BufferedImage from the offscreen buffer, (optionally) cache it,
* and paint it.
*/
public BufferedImage finishPainting(boolean useCache) {
DataBufferInt dataBuffer = new DataBufferInt(w0 * h0);
// Note that stealData() requires a markDirty() afterwards
// since we modify the data in it.
int transparency =
nativeFinishPainting(SunWritableRaster.stealData(dataBuffer, 0),
w0, h0);
SunWritableRaster.markDirty(dataBuffer);
int[] bands = BAND_OFFSETS[transparency - 1];
WritableRaster raster = Raster.createPackedRaster(
dataBuffer, w0, h0, w0, bands, null);
ColorModel cm = COLOR_MODELS[transparency - 1];
BufferedImage img = new BufferedImage(cm, raster, false, null);
if (useCache) {
cache.setImage(getClass(), null, w0, h0, cacheArgs, img);
}
graphics.drawImage(img, x0, y0, null);
return img;
}
/**
* Notify native layer of theme change, and flush cache
*/
public void themeChanged() {
synchronized(sun.awt.UNIXToolkit.GTK_LOCK) {
native_switch_theme();
}
cache.flush();
}
/* GtkSettings enum mirrors that in gtk2_interface.h */
public Object getSetting(Settings property) {
synchronized(sun.awt.UNIXToolkit.GTK_LOCK) {
return native_get_gtk_setting(property.ordinal());
}
}
/**
* Sets up the GtkAdjustment values for the native GtkRange widget
* associated with the given region (e.g. SLIDER, SCROLL_BAR).
*/
void setRangeValue(SynthContext context, Region id,
double value, double min, double max, double visible) {
int widget = getWidgetType(context.getComponent(), id).ordinal();
nativeSetRangeValue(widget, value, min, max, visible);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,127 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
import javax.swing.*;
import javax.swing.plaf.synth.*;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* @author Joshua Outwater
*/
class GTKGraphicsUtils extends SynthGraphicsUtils {
public void paintText(SynthContext context, Graphics g, String text,
int x, int y, int mnemonicIndex) {
if (text == null || text.length() <= 0) {
// We don't need to paint empty strings
return;
}
if (context.getRegion() == Region.INTERNAL_FRAME_TITLE_PANE) {
// Metacity handles painting of text on internal frame title,
// ignore this.
return;
}
int componentState = context.getComponentState();
String themeName = GTKLookAndFeel.getGtkThemeName();
if (themeName != null && themeName.startsWith("blueprint") &&
shouldShadowText(context.getRegion(), componentState)) {
g.setColor(Color.BLACK);
super.paintText(context, g, text, x+1, y+1, mnemonicIndex);
g.setColor(Color.WHITE);
}
super.paintText(context, g, text, x, y, mnemonicIndex);
}
/**
* Paints text at the specified location. This will not attempt to
* render the text as html nor will it offset by the insets of the
* component.
*
* @param ss SynthContext
* @param g Graphics used to render string in.
* @param text Text to render
* @param bounds Bounds of the text to be drawn.
* @param mnemonicIndex Index to draw string at.
*/
public void paintText(SynthContext context, Graphics g, String text,
Rectangle bounds, int mnemonicIndex) {
if (text == null || text.length() <= 0) {
// We don't need to paint empty strings
return;
}
Region id = context.getRegion();
if ((id == Region.RADIO_BUTTON ||
id == Region.CHECK_BOX ||
id == Region.TABBED_PANE_TAB) &&
(context.getComponentState() & SynthConstants.FOCUSED) != 0)
{
JComponent source = context.getComponent();
if (!(source instanceof AbstractButton) ||
((AbstractButton)source).isFocusPainted()) {
// The "bounds" parameter encompasses only the actual text;
// when drawing the focus, we need to expand that bounding
// box by "focus-line-width" plus "focus-padding". Note that
// the layout process for these components will have already
// taken these values into account, so there should always
// be enough space allocated for drawing the focus indicator.
int synthState = context.getComponentState();
GTKStyle style = (GTKStyle)context.getStyle();
int focusSize =
style.getClassSpecificIntValue(context,
"focus-line-width", 1);
int focusPad =
style.getClassSpecificIntValue(context,
"focus-padding", 1);
int totalFocus = focusSize + focusPad;
int x = bounds.x - totalFocus;
int y = bounds.y - totalFocus;
int w = bounds.width + (2 * totalFocus);
int h = bounds.height + (2 * totalFocus);
Color color = g.getColor();
GTKPainter.INSTANCE.paintFocus(context, g, id,
synthState, "checkbutton",
x, y, w, h);
g.setColor(color);
}
}
super.paintText(context, g, text, bounds, mnemonicIndex);
}
private static boolean shouldShadowText(Region id, int state) {
int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state);
return((gtkState == SynthConstants.MOUSE_OVER) &&
(id == Region.MENU ||
id == Region.MENU_ITEM ||
id == Region.CHECK_BOX_MENU_ITEM ||
id == Region.RADIO_BUTTON_MENU_ITEM));
}
}

View File

@@ -0,0 +1,363 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
import java.util.*;
import javax.swing.plaf.synth.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.lang.reflect.*;
import javax.swing.*;
import javax.swing.plaf.*;
import sun.swing.plaf.synth.*;
import com.sun.java.swing.plaf.gtk.GTKConstants.ArrowType;
import com.sun.java.swing.plaf.gtk.GTKConstants.ExpanderStyle;
import com.sun.java.swing.plaf.gtk.GTKConstants.Orientation;
import com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType;
/**
*/
class GTKIconFactory {
static final int CHECK_ICON_EXTRA_INSET = 1;
static final int DEFAULT_ICON_SPACING = 2;
static final int DEFAULT_ICON_SIZE = 13;
static final int DEFAULT_TOGGLE_MENU_ITEM_SIZE = 12; // For pre-gtk2.4
private static final String RADIO_BUTTON_ICON = "paintRadioButtonIcon";
private static final String CHECK_BOX_ICON = "paintCheckBoxIcon";
private static final String MENU_ARROW_ICON = "paintMenuArrowIcon";
private static final String CHECK_BOX_MENU_ITEM_CHECK_ICON =
"paintCheckBoxMenuItemCheckIcon";
private static final String RADIO_BUTTON_MENU_ITEM_CHECK_ICON =
"paintRadioButtonMenuItemCheckIcon";
private static final String TREE_EXPANDED_ICON = "paintTreeExpandedIcon";
private static final String TREE_COLLAPSED_ICON = "paintTreeCollapsedIcon";
private static final String ASCENDING_SORT_ICON = "paintAscendingSortIcon";
private static final String DESCENDING_SORT_ICON = "paintDescendingSortIcon";
private static final String TOOL_BAR_HANDLE_ICON = "paintToolBarHandleIcon";
private static Map<String, DelegatingIcon> iconsPool =
Collections.synchronizedMap(new HashMap<String, DelegatingIcon>());
private static DelegatingIcon getIcon(String methodName) {
DelegatingIcon result = iconsPool.get(methodName);
if (result == null) {
if (methodName == TREE_COLLAPSED_ICON ||
methodName == TREE_EXPANDED_ICON)
{
result = new SynthExpanderIcon(methodName);
} else if (methodName == TOOL_BAR_HANDLE_ICON) {
result = new ToolBarHandleIcon();
} else if (methodName == MENU_ARROW_ICON) {
result = new MenuArrowIcon();
} else {
result = new DelegatingIcon(methodName);
}
iconsPool.put(methodName, result);
}
return result;
}
//
// Sort arrow
//
public static Icon getAscendingSortIcon() {
return getIcon(ASCENDING_SORT_ICON);
}
public static Icon getDescendingSortIcon() {
return getIcon(DESCENDING_SORT_ICON);
}
//
// Tree methods
//
public static SynthIcon getTreeExpandedIcon() {
return getIcon(TREE_EXPANDED_ICON);
}
public static SynthIcon getTreeCollapsedIcon() {
return getIcon(TREE_COLLAPSED_ICON);
}
//
// Radio button
//
public static SynthIcon getRadioButtonIcon() {
return getIcon(RADIO_BUTTON_ICON);
}
//
// CheckBox
//
public static SynthIcon getCheckBoxIcon() {
return getIcon(CHECK_BOX_ICON);
}
//
// Menus
//
public static SynthIcon getMenuArrowIcon() {
return getIcon(MENU_ARROW_ICON);
}
public static SynthIcon getCheckBoxMenuItemCheckIcon() {
return getIcon(CHECK_BOX_MENU_ITEM_CHECK_ICON);
}
public static SynthIcon getRadioButtonMenuItemCheckIcon() {
return getIcon(RADIO_BUTTON_MENU_ITEM_CHECK_ICON);
}
//
// ToolBar Handle
//
public static SynthIcon getToolBarHandleIcon() {
return getIcon(TOOL_BAR_HANDLE_ICON);
}
static void resetIcons() {
synchronized (iconsPool) {
for (DelegatingIcon di: iconsPool.values()) {
di.resetIconDimensions();
}
}
}
private static class DelegatingIcon extends SynthIcon implements
UIResource {
private static final Class[] PARAM_TYPES = new Class[] {
SynthContext.class, Graphics.class, int.class,
int.class, int.class, int.class, int.class
};
private Object method;
int iconDimension = -1;
DelegatingIcon(String methodName ){
this.method = methodName;
}
public void paintIcon(SynthContext context, Graphics g,
int x, int y, int w, int h) {
if (context != null) {
GTKPainter.INSTANCE.paintIcon(context, g,
getMethod(), x, y, w, h);
}
}
public int getIconWidth(SynthContext context) {
return getIconDimension(context);
}
public int getIconHeight(SynthContext context) {
return getIconDimension(context);
}
void resetIconDimensions() {
iconDimension = -1;
}
protected Method getMethod() {
if (method instanceof String) {
method = resolveMethod((String)method);
}
return (Method)method;
}
protected Class[] getMethodParamTypes() {
return PARAM_TYPES;
}
private Method resolveMethod(String name) {
try {
return GTKPainter.class.getMethod(name, getMethodParamTypes());
} catch (NoSuchMethodException e) {
assert false;
}
return null;
}
int getIconDimension(SynthContext context) {
if (iconDimension >= 0) {
return iconDimension;
}
if (context == null) {
return DEFAULT_ICON_SIZE;
}
Region region = context.getRegion();
GTKStyle style = (GTKStyle) context.getStyle();
if (GTKLookAndFeel.is3() && region == Region.MENU) {
Object value = style.getClassSpecificValue("arrow-scaling");
if (value instanceof Number) {
iconDimension = (int)(((Number) value).floatValue() *
(style.getFont(context).getSize2D() +
2 * style.getClassSpecificIntValue(context,
"indicator-spacing", DEFAULT_ICON_SPACING)));
if (iconDimension > 0) {
return iconDimension;
}
}
}
iconDimension = style.getClassSpecificIntValue(context,
"indicator-size",
(region == Region.CHECK_BOX_MENU_ITEM ||
region == Region.RADIO_BUTTON_MENU_ITEM) ?
DEFAULT_TOGGLE_MENU_ITEM_SIZE : DEFAULT_ICON_SIZE);
if (region == Region.CHECK_BOX || region == Region.RADIO_BUTTON) {
iconDimension += 2 * style.getClassSpecificIntValue(context,
"indicator-spacing", DEFAULT_ICON_SPACING);
} else if (region == Region.CHECK_BOX_MENU_ITEM ||
region == Region.RADIO_BUTTON_MENU_ITEM) {
iconDimension += 2 * CHECK_ICON_EXTRA_INSET;
}
return iconDimension;
}
}
private static class SynthExpanderIcon extends DelegatingIcon {
SynthExpanderIcon(String method) {
super(method);
}
public void paintIcon(SynthContext context, Graphics g, int x, int y,
int w, int h) {
if (context != null) {
super.paintIcon(context, g, x, y, w, h);
updateSizeIfNecessary(context);
}
}
int getIconDimension(SynthContext context) {
updateSizeIfNecessary(context);
return (iconDimension == -1) ? DEFAULT_ICON_SIZE :
iconDimension;
}
private void updateSizeIfNecessary(SynthContext context) {
if (iconDimension == -1 && context != null) {
iconDimension = context.getStyle().getInt(context,
"Tree.expanderSize", 10);
}
}
}
// GTK has a separate widget for the handle box, to mirror this
// we create a unique icon per ToolBar and lookup the style for the
// HandleBox.
private static class ToolBarHandleIcon extends DelegatingIcon {
private static final Class[] PARAM_TYPES = new Class[] {
SynthContext.class, Graphics.class, int.class,
int.class, int.class, int.class, int.class, Orientation.class,
};
private SynthStyle style;
public ToolBarHandleIcon() {
super(TOOL_BAR_HANDLE_ICON);
}
protected Class[] getMethodParamTypes() {
return PARAM_TYPES;
}
public void paintIcon(SynthContext context, Graphics g, int x, int y,
int w, int h) {
if (context != null) {
JToolBar toolbar = (JToolBar)context.getComponent();
Orientation orientation =
(toolbar.getOrientation() == JToolBar.HORIZONTAL ?
Orientation.HORIZONTAL : Orientation.VERTICAL);
if (style == null) {
style = SynthLookAndFeel.getStyleFactory().getStyle(
context.getComponent(), GTKRegion.HANDLE_BOX);
}
context = new SynthContext(toolbar, GTKRegion.HANDLE_BOX,
style, SynthConstants.ENABLED);
GTKPainter.INSTANCE.paintIcon(context, g,
getMethod(), x, y, w, h, orientation);
}
}
public int getIconWidth(SynthContext context) {
if (context == null) {
return 10;
}
if (((JToolBar)context.getComponent()).getOrientation() ==
JToolBar.HORIZONTAL) {
return 10;
} else {
return context.getComponent().getWidth();
}
}
public int getIconHeight(SynthContext context) {
if (context == null) {
return 10;
}
if (((JToolBar)context.getComponent()).getOrientation() ==
JToolBar.HORIZONTAL) {
return context.getComponent().getHeight();
} else {
return 10;
}
}
}
private static class MenuArrowIcon extends DelegatingIcon {
private static final Class[] PARAM_TYPES = new Class[] {
SynthContext.class, Graphics.class, int.class,
int.class, int.class, int.class, int.class, ArrowType.class,
};
public MenuArrowIcon() {
super(MENU_ARROW_ICON);
}
protected Class[] getMethodParamTypes() {
return PARAM_TYPES;
}
public void paintIcon(SynthContext context, Graphics g, int x, int y,
int w, int h) {
if (context != null) {
ArrowType arrowDir = ArrowType.RIGHT;
if (!context.getComponent().getComponentOrientation().isLeftToRight()) {
arrowDir = ArrowType.LEFT;
}
GTKPainter.INSTANCE.paintIcon(context, g,
getMethod(), x, y, w, h, arrowDir);
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
import javax.swing.plaf.synth.Region;
/**
* A typesafe enumeration of the distinct rendering portions specific
* to GTK.
*
* @author Scott Violet
*/
class GTKRegion extends Region {
public static final Region HANDLE_BOX = new GTKRegion("HandleBox", null,
true);
protected GTKRegion(String name, String ui, boolean subregion) {
super(name, ui, subregion);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,188 @@
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
import java.awt.Font;
import java.util.*;
import javax.swing.*;
import javax.swing.plaf.synth.*;
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType;
/**
*
* @author Scott Violet
*/
class GTKStyleFactory extends SynthStyleFactory {
/**
* Saves all styles that have been accessed. In most common cases,
* the hash key is simply the WidgetType, but in more complex cases
* it will be a ComplexKey object that contains arguments to help
* differentiate similar styles.
*/
private final Map<Object, GTKStyle> stylesCache;
private Font defaultFont;
GTKStyleFactory() {
stylesCache = new HashMap<Object, GTKStyle>();
}
/**
* Returns the <code>GTKStyle</code> to use based on the
* <code>Region</code> id
*
* @param c this parameter isn't used, may be null.
* @param id of the region to get the style.
*/
public synchronized SynthStyle getStyle(JComponent c, Region id) {
WidgetType wt = GTKEngine.getWidgetType(c, id);
Object key = null;
if (id == Region.SCROLL_BAR) {
// The style/insets of a scrollbar can depend on a number of
// factors (see GTKStyle.getScrollBarInsets()) so use a
// complex key here.
if (c != null) {
JScrollBar sb = (JScrollBar)c;
boolean sp = (sb.getParent() instanceof JScrollPane);
boolean horiz = (sb.getOrientation() == JScrollBar.HORIZONTAL);
boolean ltr = sb.getComponentOrientation().isLeftToRight();
boolean focusable = sb.isFocusable();
key = new ComplexKey(wt, sp, horiz, ltr, focusable);
}
}
else if (id == Region.CHECK_BOX || id == Region.RADIO_BUTTON) {
// The style/insets of a checkbox or radiobutton can depend
// on the component orientation, so use a complex key here.
if (c != null) {
boolean ltr = c.getComponentOrientation().isLeftToRight();
key = new ComplexKey(wt, ltr);
}
}
else if (id == Region.BUTTON) {
// The style/insets of a button can depend on whether it is
// default capable or in a toolbar, so use a complex key here.
if (c != null) {
JButton btn = (JButton)c;
boolean toolButton = (btn.getParent() instanceof JToolBar);
boolean defaultCapable = btn.isDefaultCapable();
key = new ComplexKey(wt, toolButton, defaultCapable);
}
} else if (id == Region.MENU) {
if (c instanceof JMenu && ((JMenu) c).isTopLevelMenu() &&
UIManager.getBoolean("Menu.useMenuBarForTopLevelMenus")) {
wt = WidgetType.MENU_BAR;
}
}
if (key == null) {
// Otherwise, just use the WidgetType as the key.
key = wt;
}
GTKStyle result = stylesCache.get(key);
if (result == null) {
result = new GTKStyle(defaultFont, wt);
stylesCache.put(key, result);
}
return result;
}
void initStyles(Font defaultFont) {
this.defaultFont = defaultFont;
stylesCache.clear();
}
/**
* Represents a hash key used for fetching GTKStyle objects from the
* cache. In most cases only the WidgetType is used for lookup, but
* in some complex cases, other Object arguments can be specified
* via a ComplexKey to differentiate the various styles.
*/
private static class ComplexKey {
private final WidgetType wt;
private final Object[] args;
ComplexKey(WidgetType wt, Object... args) {
this.wt = wt;
this.args = args;
}
@Override
public int hashCode() {
int hash = wt.hashCode();
if (args != null) {
for (Object arg : args) {
hash = hash*29 + (arg == null ? 0 : arg.hashCode());
}
}
return hash;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof ComplexKey)) {
return false;
}
ComplexKey that = (ComplexKey)o;
if (this.wt == that.wt) {
if (this.args == null && that.args == null) {
return true;
}
if (this.args != null && that.args != null &&
this.args.length == that.args.length)
{
for (int i = 0; i < this.args.length; i++) {
Object a1 = this.args[i];
Object a2 = that.args[i];
if (!(a1==null ? a2==null : a1.equals(a2))) {
return false;
}
}
return true;
}
}
return false;
}
@Override
public String toString() {
String str = "ComplexKey[wt=" + wt;
if (args != null) {
str += ",args=[";
for (int i = 0; i < args.length; i++) {
str += args[i];
if (i < args.length-1) str += ",";
}
str += "]";
}
str += "]";
return str;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,233 @@
/*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
import java.awt.*;
import java.awt.geom.AffineTransform;
import javax.swing.plaf.FontUIResource;
import java.util.StringTokenizer;
import sun.font.FontConfigManager;
import sun.font.FontUtilities;
/**
* @author Shannon Hickey
* @author Leif Samuelsson
*/
class PangoFonts {
public static final String CHARS_DIGITS = "0123456789";
/**
* Calculate a default scale factor for fonts in this L&F to match
* the reported resolution of the screen.
* Java 2D specified a default user-space scale of 72dpi.
* This is unlikely to correspond to that of the real screen.
* The Xserver reports a value which may be used to adjust for this.
* and Java 2D exposes it via a normalizing transform.
* However many Xservers report a hard-coded 90dpi whilst others report a
* calculated value based on possibly incorrect data.
* That is something that must be solved at the X11 level
* Note that in an X11 multi-screen environment, the default screen
* is the one used by the JRE so it is safe to use it here.
*/
private static double fontScale;
static {
fontScale = 1.0d;
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (!ge.isHeadless()) {
GraphicsConfiguration gc =
ge.getDefaultScreenDevice().getDefaultConfiguration();
AffineTransform at = gc.getNormalizingTransform();
fontScale = at.getScaleY();
}
}
/**
* Parses a String containing a pango font description and returns
* a Font object.
*
* @param pangoName a String describing a pango font
* e.g. "Sans Italic 10"
* @return a Font object as a FontUIResource
* or null if no suitable font could be created.
*/
static Font lookupFont(String pangoName) {
String family = "";
int style = Font.PLAIN;
int size = 10;
StringTokenizer tok = new StringTokenizer(pangoName);
while (tok.hasMoreTokens()) {
String word = tok.nextToken();
if (word.equalsIgnoreCase("italic")) {
style |= Font.ITALIC;
} else if (word.equalsIgnoreCase("bold")) {
style |= Font.BOLD;
} else if (CHARS_DIGITS.indexOf(word.charAt(0)) != -1) {
try {
size = Integer.parseInt(word);
} catch (NumberFormatException ex) {
}
} else {
if (family.length() > 0) {
family += " ";
}
family += word;
}
}
/*
* Java 2D font point sizes are in a user-space scale of 72dpi.
* GTK allows a user to configure a "dpi" property used to scale
* the fonts used to match a user's preference.
* To match the font size of GTK apps we need to obtain this DPI and
* adjust as follows:
* Some versions of GTK use XSETTINGS if available to dynamically
* monitor user-initiated changes in the DPI to be used by GTK
* apps. This value is also made available as the Xft.dpi X resource.
* This is presumably a function of the font preferences API and/or
* the manner in which it requests the toolkit to update the default
* for the desktop. This dual approach is probably necessary since
* other versions of GTK - or perhaps some apps - determine the size
* to use only at start-up from that X resource.
* If that resource is not set then GTK scales for the DPI resolution
* reported by the Xserver using the formula
* DisplayHeight(dpy, screen) / DisplayHeightMM(dpy, screen) * 25.4
* (25.4mm == 1 inch).
* JDK tracks the Xft.dpi XSETTINGS property directly so it can
* dynamically change font size by tracking just that value.
* If that resource is not available use the same fall back formula
* as GTK (see calculation for fontScale).
*
* GTK's default setting for Xft.dpi is 96 dpi (and it seems -1
* apparently also can mean that "default"). However this default
* isn't used if there's no property set. The real default in the
* absence of a resource is the Xserver reported dpi.
* Finally this DPI is used to calculate the nearest Java 2D font
* 72 dpi font size.
* There are cases in which JDK behaviour may not exactly mimic
* GTK native app behaviour :
* 1) When a GTK app is not able to dynamically track the changes
* (does not use XSETTINGS), JDK will resize but other apps will
* not. This is OK as JDK is exhibiting preferred behaviour and
* this is probably how all later GTK apps will behave
* 2) When a GTK app does not use XSETTINGS and for some reason
* the XRDB property is not present. JDK will pick up XSETTINGS
* and the GTK app will use the Xserver default. Since its
* impossible for JDK to know that some other GTK app is not
* using XSETTINGS its impossible to account for this and in any
* case for it to be a problem the values would have to be different.
* It also seems unlikely to arise except when a user explicitly
* deletes the X resource database entry.
* There also some other issues to be aware of for the future:
* GTK specifies the Xft.dpi value as server-wide which when used
* on systems with 2 distinct X screens with different physical DPI
* the font sizes will inevitably appear different. It would have
* been a more user-friendly design to further adjust that one
* setting depending on the screen resolution to achieve perceived
* equivalent sizes. If such a change were ever to be made in GTK
* we would need to update for that.
*/
double dsize = size;
int dpi = 96;
Object value =
Toolkit.getDefaultToolkit().getDesktopProperty("gnome.Xft/DPI");
if (value instanceof Integer) {
dpi = ((Integer)value).intValue() / 1024;
if (dpi == -1) {
dpi = 96;
}
if (dpi < 50) { /* 50 dpi is the minimum value gnome allows */
dpi = 50;
}
/* The Java rasteriser assumes pts are in a user space of
* 72 dpi, so we need to adjust for that.
*/
dsize = ((double)(dpi * size)/ 72.0);
} else {
/* If there's no property, GTK scales for the resolution
* reported by the Xserver using the formula listed above.
* fontScale already accounts for the 72 dpi Java 2D space.
*/
dsize = size * fontScale;
}
/* Round size to nearest integer pt size */
size = (int)(dsize + 0.5);
if (size < 1) {
size = 1;
}
String fcFamilyLC = family.toLowerCase();
if (FontUtilities.mapFcName(fcFamilyLC) != null) {
/* family is a Fc/Pango logical font which we need to expand. */
Font font = FontUtilities.getFontConfigFUIR(fcFamilyLC, style, size);
font = font.deriveFont(style, (float)dsize);
return new FontUIResource(font);
} else {
/* It's a physical font which we will create with a fallback */
Font font = new Font(family, style, size);
/* a roundabout way to set the font size in floating points */
font = font.deriveFont(style, (float)dsize);
FontUIResource fuir = new FontUIResource(font);
return FontUtilities.getCompositeFontUIResource(fuir);
}
}
/**
* Parses a String containing a pango font description and returns
* the (unscaled) font size as an integer.
*
* @param pangoName a String describing a pango font
* @return the size of the font described by pangoName (e.g. if
* pangoName is "Sans Italic 10", then this method returns 10)
*/
static int getFontSize(String pangoName) {
int size = 10;
StringTokenizer tok = new StringTokenizer(pangoName);
while (tok.hasMoreTokens()) {
String word = tok.nextToken();
if (CHARS_DIGITS.indexOf(word.charAt(0)) != -1) {
try {
size = Integer.parseInt(word);
} catch (NumberFormatException ex) {
}
}
}
return size;
}
}

View File

@@ -0,0 +1,831 @@
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.java.swing.plaf.gtk;
import java.awt.Color;
import java.util.Arrays;
import javax.swing.plaf.ColorUIResource;
/**
* @author Shannon Hickey
*/
class XColors {
private static class XColor implements Comparable {
String name;
int red;
int green;
int blue;
XColor(String name, int red, int green, int blue) {
this.name = name;
this.red = red;
this.green = green;
this.blue = blue;
}
Color toColor() {
return new ColorUIResource(red, green, blue);
}
public int compareTo(Object o) {
XColor other = (XColor)o;
return name.compareTo(other.name);
}
}
private static XColor key = new XColor("", -1, -1, -1);
static Color lookupColor(String name) {
key.name = name.toLowerCase();
int pos = Arrays.binarySearch(colors, key);
if (pos < 0) {
return null;
}
return colors[pos].toColor();
}
private static final XColor[] colors = {
new XColor("alice blue", 240, 248, 255),
new XColor("aliceblue", 240, 248, 255),
new XColor("antique white", 250, 235, 215),
new XColor("antiquewhite", 250, 235, 215),
new XColor("antiquewhite1", 255, 239, 219),
new XColor("antiquewhite2", 238, 223, 204),
new XColor("antiquewhite3", 205, 192, 176),
new XColor("antiquewhite4", 139, 131, 120),
new XColor("aquamarine", 127, 255, 212),
new XColor("aquamarine1", 127, 255, 212),
new XColor("aquamarine2", 118, 238, 198),
new XColor("aquamarine3", 102, 205, 170),
new XColor("aquamarine4", 69, 139, 116),
new XColor("azure", 240, 255, 255),
new XColor("azure1", 240, 255, 255),
new XColor("azure2", 224, 238, 238),
new XColor("azure3", 193, 205, 205),
new XColor("azure4", 131, 139, 139),
new XColor("beige", 245, 245, 220),
new XColor("bisque", 255, 228, 196),
new XColor("bisque1", 255, 228, 196),
new XColor("bisque2", 238, 213, 183),
new XColor("bisque3", 205, 183, 158),
new XColor("bisque4", 139, 125, 107),
new XColor("black", 0, 0, 0),
new XColor("blanched almond", 255, 235, 205),
new XColor("blanchedalmond", 255, 235, 205),
new XColor("blue", 0, 0, 255),
new XColor("blue violet", 138, 43, 226),
new XColor("blue1", 0, 0, 255),
new XColor("blue2", 0, 0, 238),
new XColor("blue3", 0, 0, 205),
new XColor("blue4", 0, 0, 139),
new XColor("blueviolet", 138, 43, 226),
new XColor("brown", 165, 42, 42),
new XColor("brown1", 255, 64, 64),
new XColor("brown2", 238, 59, 59),
new XColor("brown3", 205, 51, 51),
new XColor("brown4", 139, 35, 35),
new XColor("burlywood", 222, 184, 135),
new XColor("burlywood1", 255, 211, 155),
new XColor("burlywood2", 238, 197, 145),
new XColor("burlywood3", 205, 170, 125),
new XColor("burlywood4", 139, 115, 85),
new XColor("cadet blue", 95, 158, 160),
new XColor("cadetblue", 95, 158, 160),
new XColor("cadetblue1", 152, 245, 255),
new XColor("cadetblue2", 142, 229, 238),
new XColor("cadetblue3", 122, 197, 205),
new XColor("cadetblue4", 83, 134, 139),
new XColor("chartreuse", 127, 255, 0),
new XColor("chartreuse1", 127, 255, 0),
new XColor("chartreuse2", 118, 238, 0),
new XColor("chartreuse3", 102, 205, 0),
new XColor("chartreuse4", 69, 139, 0),
new XColor("chocolate", 210, 105, 30),
new XColor("chocolate1", 255, 127, 36),
new XColor("chocolate2", 238, 118, 33),
new XColor("chocolate3", 205, 102, 29),
new XColor("chocolate4", 139, 69, 19),
new XColor("coral", 255, 127, 80),
new XColor("coral1", 255, 114, 86),
new XColor("coral2", 238, 106, 80),
new XColor("coral3", 205, 91, 69),
new XColor("coral4", 139, 62, 47),
new XColor("cornflower blue", 100, 149, 237),
new XColor("cornflowerblue", 100, 149, 237),
new XColor("cornsilk", 255, 248, 220),
new XColor("cornsilk1", 255, 248, 220),
new XColor("cornsilk2", 238, 232, 205),
new XColor("cornsilk3", 205, 200, 177),
new XColor("cornsilk4", 139, 136, 120),
new XColor("cyan", 0, 255, 255),
new XColor("cyan1", 0, 255, 255),
new XColor("cyan2", 0, 238, 238),
new XColor("cyan3", 0, 205, 205),
new XColor("cyan4", 0, 139, 139),
new XColor("dark blue", 0, 0, 139),
new XColor("dark cyan", 0, 139, 139),
new XColor("dark goldenrod", 184, 134, 11),
new XColor("dark gray", 169, 169, 169),
new XColor("dark green", 0, 100, 0),
new XColor("dark grey", 169, 169, 169),
new XColor("dark khaki", 189, 183, 107),
new XColor("dark magenta", 139, 0, 139),
new XColor("dark olive green", 85, 107, 47),
new XColor("dark orange", 255, 140, 0),
new XColor("dark orchid", 153, 50, 204),
new XColor("dark red", 139, 0, 0),
new XColor("dark salmon", 233, 150, 122),
new XColor("dark sea green", 143, 188, 143),
new XColor("dark slate blue", 72, 61, 139),
new XColor("dark slate gray", 47, 79, 79),
new XColor("dark slate grey", 47, 79, 79),
new XColor("dark turquoise", 0, 206, 209),
new XColor("dark violet", 148, 0, 211),
new XColor("darkblue", 0, 0, 139),
new XColor("darkcyan", 0, 139, 139),
new XColor("darkgoldenrod", 184, 134, 11),
new XColor("darkgoldenrod1", 255, 185, 15),
new XColor("darkgoldenrod2", 238, 173, 14),
new XColor("darkgoldenrod3", 205, 149, 12),
new XColor("darkgoldenrod4", 139, 101, 8),
new XColor("darkgray", 169, 169, 169),
new XColor("darkgreen", 0, 100, 0),
new XColor("darkgrey", 169, 169, 169),
new XColor("darkkhaki", 189, 183, 107),
new XColor("darkmagenta", 139, 0, 139),
new XColor("darkolivegreen", 85, 107, 47),
new XColor("darkolivegreen1", 202, 255, 112),
new XColor("darkolivegreen2", 188, 238, 104),
new XColor("darkolivegreen3", 162, 205, 90),
new XColor("darkolivegreen4", 110, 139, 61),
new XColor("darkorange", 255, 140, 0),
new XColor("darkorange1", 255, 127, 0),
new XColor("darkorange2", 238, 118, 0),
new XColor("darkorange3", 205, 102, 0),
new XColor("darkorange4", 139, 69, 0),
new XColor("darkorchid", 153, 50, 204),
new XColor("darkorchid1", 191, 62, 255),
new XColor("darkorchid2", 178, 58, 238),
new XColor("darkorchid3", 154, 50, 205),
new XColor("darkorchid4", 104, 34, 139),
new XColor("darkred", 139, 0, 0),
new XColor("darksalmon", 233, 150, 122),
new XColor("darkseagreen", 143, 188, 143),
new XColor("darkseagreen1", 193, 255, 193),
new XColor("darkseagreen2", 180, 238, 180),
new XColor("darkseagreen3", 155, 205, 155),
new XColor("darkseagreen4", 105, 139, 105),
new XColor("darkslateblue", 72, 61, 139),
new XColor("darkslategray", 47, 79, 79),
new XColor("darkslategray1", 151, 255, 255),
new XColor("darkslategray2", 141, 238, 238),
new XColor("darkslategray3", 121, 205, 205),
new XColor("darkslategray4", 82, 139, 139),
new XColor("darkslategrey", 47, 79, 79),
new XColor("darkturquoise", 0, 206, 209),
new XColor("darkviolet", 148, 0, 211),
new XColor("deep pink", 255, 20, 147),
new XColor("deep sky blue", 0, 191, 255),
new XColor("deeppink", 255, 20, 147),
new XColor("deeppink1", 255, 20, 147),
new XColor("deeppink2", 238, 18, 137),
new XColor("deeppink3", 205, 16, 118),
new XColor("deeppink4", 139, 10, 80),
new XColor("deepskyblue", 0, 191, 255),
new XColor("deepskyblue1", 0, 191, 255),
new XColor("deepskyblue2", 0, 178, 238),
new XColor("deepskyblue3", 0, 154, 205),
new XColor("deepskyblue4", 0, 104, 139),
new XColor("dim gray", 105, 105, 105),
new XColor("dim grey", 105, 105, 105),
new XColor("dimgray", 105, 105, 105),
new XColor("dimgrey", 105, 105, 105),
new XColor("dodger blue", 30, 144, 255),
new XColor("dodgerblue", 30, 144, 255),
new XColor("dodgerblue1", 30, 144, 255),
new XColor("dodgerblue2", 28, 134, 238),
new XColor("dodgerblue3", 24, 116, 205),
new XColor("dodgerblue4", 16, 78, 139),
new XColor("firebrick", 178, 34, 34),
new XColor("firebrick1", 255, 48, 48),
new XColor("firebrick2", 238, 44, 44),
new XColor("firebrick3", 205, 38, 38),
new XColor("firebrick4", 139, 26, 26),
new XColor("floral white", 255, 250, 240),
new XColor("floralwhite", 255, 250, 240),
new XColor("forest green", 34, 139, 34),
new XColor("forestgreen", 34, 139, 34),
new XColor("gainsboro", 220, 220, 220),
new XColor("ghost white", 248, 248, 255),
new XColor("ghostwhite", 248, 248, 255),
new XColor("gold", 255, 215, 0),
new XColor("gold1", 255, 215, 0),
new XColor("gold2", 238, 201, 0),
new XColor("gold3", 205, 173, 0),
new XColor("gold4", 139, 117, 0),
new XColor("goldenrod", 218, 165, 32),
new XColor("goldenrod1", 255, 193, 37),
new XColor("goldenrod2", 238, 180, 34),
new XColor("goldenrod3", 205, 155, 29),
new XColor("goldenrod4", 139, 105, 20),
new XColor("gray", 190, 190, 190),
new XColor("gray0", 0, 0, 0),
new XColor("gray1", 3, 3, 3),
new XColor("gray10", 26, 26, 26),
new XColor("gray100", 255, 255, 255),
new XColor("gray11", 28, 28, 28),
new XColor("gray12", 31, 31, 31),
new XColor("gray13", 33, 33, 33),
new XColor("gray14", 36, 36, 36),
new XColor("gray15", 38, 38, 38),
new XColor("gray16", 41, 41, 41),
new XColor("gray17", 43, 43, 43),
new XColor("gray18", 46, 46, 46),
new XColor("gray19", 48, 48, 48),
new XColor("gray2", 5, 5, 5),
new XColor("gray20", 51, 51, 51),
new XColor("gray21", 54, 54, 54),
new XColor("gray22", 56, 56, 56),
new XColor("gray23", 59, 59, 59),
new XColor("gray24", 61, 61, 61),
new XColor("gray25", 64, 64, 64),
new XColor("gray26", 66, 66, 66),
new XColor("gray27", 69, 69, 69),
new XColor("gray28", 71, 71, 71),
new XColor("gray29", 74, 74, 74),
new XColor("gray3", 8, 8, 8),
new XColor("gray30", 77, 77, 77),
new XColor("gray31", 79, 79, 79),
new XColor("gray32", 82, 82, 82),
new XColor("gray33", 84, 84, 84),
new XColor("gray34", 87, 87, 87),
new XColor("gray35", 89, 89, 89),
new XColor("gray36", 92, 92, 92),
new XColor("gray37", 94, 94, 94),
new XColor("gray38", 97, 97, 97),
new XColor("gray39", 99, 99, 99),
new XColor("gray4", 10, 10, 10),
new XColor("gray40", 102, 102, 102),
new XColor("gray41", 105, 105, 105),
new XColor("gray42", 107, 107, 107),
new XColor("gray43", 110, 110, 110),
new XColor("gray44", 112, 112, 112),
new XColor("gray45", 115, 115, 115),
new XColor("gray46", 117, 117, 117),
new XColor("gray47", 120, 120, 120),
new XColor("gray48", 122, 122, 122),
new XColor("gray49", 125, 125, 125),
new XColor("gray5", 13, 13, 13),
new XColor("gray50", 127, 127, 127),
new XColor("gray51", 130, 130, 130),
new XColor("gray52", 133, 133, 133),
new XColor("gray53", 135, 135, 135),
new XColor("gray54", 138, 138, 138),
new XColor("gray55", 140, 140, 140),
new XColor("gray56", 143, 143, 143),
new XColor("gray57", 145, 145, 145),
new XColor("gray58", 148, 148, 148),
new XColor("gray59", 150, 150, 150),
new XColor("gray6", 15, 15, 15),
new XColor("gray60", 153, 153, 153),
new XColor("gray61", 156, 156, 156),
new XColor("gray62", 158, 158, 158),
new XColor("gray63", 161, 161, 161),
new XColor("gray64", 163, 163, 163),
new XColor("gray65", 166, 166, 166),
new XColor("gray66", 168, 168, 168),
new XColor("gray67", 171, 171, 171),
new XColor("gray68", 173, 173, 173),
new XColor("gray69", 176, 176, 176),
new XColor("gray7", 18, 18, 18),
new XColor("gray70", 179, 179, 179),
new XColor("gray71", 181, 181, 181),
new XColor("gray72", 184, 184, 184),
new XColor("gray73", 186, 186, 186),
new XColor("gray74", 189, 189, 189),
new XColor("gray75", 191, 191, 191),
new XColor("gray76", 194, 194, 194),
new XColor("gray77", 196, 196, 196),
new XColor("gray78", 199, 199, 199),
new XColor("gray79", 201, 201, 201),
new XColor("gray8", 20, 20, 20),
new XColor("gray80", 204, 204, 204),
new XColor("gray81", 207, 207, 207),
new XColor("gray82", 209, 209, 209),
new XColor("gray83", 212, 212, 212),
new XColor("gray84", 214, 214, 214),
new XColor("gray85", 217, 217, 217),
new XColor("gray86", 219, 219, 219),
new XColor("gray87", 222, 222, 222),
new XColor("gray88", 224, 224, 224),
new XColor("gray89", 227, 227, 227),
new XColor("gray9", 23, 23, 23),
new XColor("gray90", 229, 229, 229),
new XColor("gray91", 232, 232, 232),
new XColor("gray92", 235, 235, 235),
new XColor("gray93", 237, 237, 237),
new XColor("gray94", 240, 240, 240),
new XColor("gray95", 242, 242, 242),
new XColor("gray96", 245, 245, 245),
new XColor("gray97", 247, 247, 247),
new XColor("gray98", 250, 250, 250),
new XColor("gray99", 252, 252, 252),
new XColor("green", 0, 255, 0),
new XColor("green yellow", 173, 255, 47),
new XColor("green1", 0, 255, 0),
new XColor("green2", 0, 238, 0),
new XColor("green3", 0, 205, 0),
new XColor("green4", 0, 139, 0),
new XColor("greenyellow", 173, 255, 47),
new XColor("grey", 190, 190, 190),
new XColor("grey0", 0, 0, 0),
new XColor("grey1", 3, 3, 3),
new XColor("grey10", 26, 26, 26),
new XColor("grey100", 255, 255, 255),
new XColor("grey11", 28, 28, 28),
new XColor("grey12", 31, 31, 31),
new XColor("grey13", 33, 33, 33),
new XColor("grey14", 36, 36, 36),
new XColor("grey15", 38, 38, 38),
new XColor("grey16", 41, 41, 41),
new XColor("grey17", 43, 43, 43),
new XColor("grey18", 46, 46, 46),
new XColor("grey19", 48, 48, 48),
new XColor("grey2", 5, 5, 5),
new XColor("grey20", 51, 51, 51),
new XColor("grey21", 54, 54, 54),
new XColor("grey22", 56, 56, 56),
new XColor("grey23", 59, 59, 59),
new XColor("grey24", 61, 61, 61),
new XColor("grey25", 64, 64, 64),
new XColor("grey26", 66, 66, 66),
new XColor("grey27", 69, 69, 69),
new XColor("grey28", 71, 71, 71),
new XColor("grey29", 74, 74, 74),
new XColor("grey3", 8, 8, 8),
new XColor("grey30", 77, 77, 77),
new XColor("grey31", 79, 79, 79),
new XColor("grey32", 82, 82, 82),
new XColor("grey33", 84, 84, 84),
new XColor("grey34", 87, 87, 87),
new XColor("grey35", 89, 89, 89),
new XColor("grey36", 92, 92, 92),
new XColor("grey37", 94, 94, 94),
new XColor("grey38", 97, 97, 97),
new XColor("grey39", 99, 99, 99),
new XColor("grey4", 10, 10, 10),
new XColor("grey40", 102, 102, 102),
new XColor("grey41", 105, 105, 105),
new XColor("grey42", 107, 107, 107),
new XColor("grey43", 110, 110, 110),
new XColor("grey44", 112, 112, 112),
new XColor("grey45", 115, 115, 115),
new XColor("grey46", 117, 117, 117),
new XColor("grey47", 120, 120, 120),
new XColor("grey48", 122, 122, 122),
new XColor("grey49", 125, 125, 125),
new XColor("grey5", 13, 13, 13),
new XColor("grey50", 127, 127, 127),
new XColor("grey51", 130, 130, 130),
new XColor("grey52", 133, 133, 133),
new XColor("grey53", 135, 135, 135),
new XColor("grey54", 138, 138, 138),
new XColor("grey55", 140, 140, 140),
new XColor("grey56", 143, 143, 143),
new XColor("grey57", 145, 145, 145),
new XColor("grey58", 148, 148, 148),
new XColor("grey59", 150, 150, 150),
new XColor("grey6", 15, 15, 15),
new XColor("grey60", 153, 153, 153),
new XColor("grey61", 156, 156, 156),
new XColor("grey62", 158, 158, 158),
new XColor("grey63", 161, 161, 161),
new XColor("grey64", 163, 163, 163),
new XColor("grey65", 166, 166, 166),
new XColor("grey66", 168, 168, 168),
new XColor("grey67", 171, 171, 171),
new XColor("grey68", 173, 173, 173),
new XColor("grey69", 176, 176, 176),
new XColor("grey7", 18, 18, 18),
new XColor("grey70", 179, 179, 179),
new XColor("grey71", 181, 181, 181),
new XColor("grey72", 184, 184, 184),
new XColor("grey73", 186, 186, 186),
new XColor("grey74", 189, 189, 189),
new XColor("grey75", 191, 191, 191),
new XColor("grey76", 194, 194, 194),
new XColor("grey77", 196, 196, 196),
new XColor("grey78", 199, 199, 199),
new XColor("grey79", 201, 201, 201),
new XColor("grey8", 20, 20, 20),
new XColor("grey80", 204, 204, 204),
new XColor("grey81", 207, 207, 207),
new XColor("grey82", 209, 209, 209),
new XColor("grey83", 212, 212, 212),
new XColor("grey84", 214, 214, 214),
new XColor("grey85", 217, 217, 217),
new XColor("grey86", 219, 219, 219),
new XColor("grey87", 222, 222, 222),
new XColor("grey88", 224, 224, 224),
new XColor("grey89", 227, 227, 227),
new XColor("grey9", 23, 23, 23),
new XColor("grey90", 229, 229, 229),
new XColor("grey91", 232, 232, 232),
new XColor("grey92", 235, 235, 235),
new XColor("grey93", 237, 237, 237),
new XColor("grey94", 240, 240, 240),
new XColor("grey95", 242, 242, 242),
new XColor("grey96", 245, 245, 245),
new XColor("grey97", 247, 247, 247),
new XColor("grey98", 250, 250, 250),
new XColor("grey99", 252, 252, 252),
new XColor("honeydew", 240, 255, 240),
new XColor("honeydew1", 240, 255, 240),
new XColor("honeydew2", 224, 238, 224),
new XColor("honeydew3", 193, 205, 193),
new XColor("honeydew4", 131, 139, 131),
new XColor("hot pink", 255, 105, 180),
new XColor("hotpink", 255, 105, 180),
new XColor("hotpink1", 255, 110, 180),
new XColor("hotpink2", 238, 106, 167),
new XColor("hotpink3", 205, 96, 144),
new XColor("hotpink4", 139, 58, 98),
new XColor("indian red", 205, 92, 92),
new XColor("indianred", 205, 92, 92),
new XColor("indianred1", 255, 106, 106),
new XColor("indianred2", 238, 99, 99),
new XColor("indianred3", 205, 85, 85),
new XColor("indianred4", 139, 58, 58),
new XColor("ivory", 255, 255, 240),
new XColor("ivory1", 255, 255, 240),
new XColor("ivory2", 238, 238, 224),
new XColor("ivory3", 205, 205, 193),
new XColor("ivory4", 139, 139, 131),
new XColor("khaki", 240, 230, 140),
new XColor("khaki1", 255, 246, 143),
new XColor("khaki2", 238, 230, 133),
new XColor("khaki3", 205, 198, 115),
new XColor("khaki4", 139, 134, 78),
new XColor("lavender", 230, 230, 250),
new XColor("lavender blush", 255, 240, 245),
new XColor("lavenderblush", 255, 240, 245),
new XColor("lavenderblush1", 255, 240, 245),
new XColor("lavenderblush2", 238, 224, 229),
new XColor("lavenderblush3", 205, 193, 197),
new XColor("lavenderblush4", 139, 131, 134),
new XColor("lawn green", 124, 252, 0),
new XColor("lawngreen", 124, 252, 0),
new XColor("lemon chiffon", 255, 250, 205),
new XColor("lemonchiffon", 255, 250, 205),
new XColor("lemonchiffon1", 255, 250, 205),
new XColor("lemonchiffon2", 238, 233, 191),
new XColor("lemonchiffon3", 205, 201, 165),
new XColor("lemonchiffon4", 139, 137, 112),
new XColor("light blue", 173, 216, 230),
new XColor("light coral", 240, 128, 128),
new XColor("light cyan", 224, 255, 255),
new XColor("light goldenrod", 238, 221, 130),
new XColor("light goldenrod yellow", 250, 250, 210),
new XColor("light gray", 211, 211, 211),
new XColor("light green", 144, 238, 144),
new XColor("light grey", 211, 211, 211),
new XColor("light pink", 255, 182, 193),
new XColor("light salmon", 255, 160, 122),
new XColor("light sea green", 32, 178, 170),
new XColor("light sky blue", 135, 206, 250),
new XColor("light slate blue", 132, 112, 255),
new XColor("light slate gray", 119, 136, 153),
new XColor("light slate grey", 119, 136, 153),
new XColor("light steel blue", 176, 196, 222),
new XColor("light yellow", 255, 255, 224),
new XColor("lightblue", 173, 216, 230),
new XColor("lightblue1", 191, 239, 255),
new XColor("lightblue2", 178, 223, 238),
new XColor("lightblue3", 154, 192, 205),
new XColor("lightblue4", 104, 131, 139),
new XColor("lightcoral", 240, 128, 128),
new XColor("lightcyan", 224, 255, 255),
new XColor("lightcyan1", 224, 255, 255),
new XColor("lightcyan2", 209, 238, 238),
new XColor("lightcyan3", 180, 205, 205),
new XColor("lightcyan4", 122, 139, 139),
new XColor("lightgoldenrod", 238, 221, 130),
new XColor("lightgoldenrod1", 255, 236, 139),
new XColor("lightgoldenrod2", 238, 220, 130),
new XColor("lightgoldenrod3", 205, 190, 112),
new XColor("lightgoldenrod4", 139, 129, 76),
new XColor("lightgoldenrodyellow", 250, 250, 210),
new XColor("lightgray", 211, 211, 211),
new XColor("lightgreen", 144, 238, 144),
new XColor("lightgrey", 211, 211, 211),
new XColor("lightpink", 255, 182, 193),
new XColor("lightpink1", 255, 174, 185),
new XColor("lightpink2", 238, 162, 173),
new XColor("lightpink3", 205, 140, 149),
new XColor("lightpink4", 139, 95, 101),
new XColor("lightsalmon", 255, 160, 122),
new XColor("lightsalmon1", 255, 160, 122),
new XColor("lightsalmon2", 238, 149, 114),
new XColor("lightsalmon3", 205, 129, 98),
new XColor("lightsalmon4", 139, 87, 66),
new XColor("lightseagreen", 32, 178, 170),
new XColor("lightskyblue", 135, 206, 250),
new XColor("lightskyblue1", 176, 226, 255),
new XColor("lightskyblue2", 164, 211, 238),
new XColor("lightskyblue3", 141, 182, 205),
new XColor("lightskyblue4", 96, 123, 139),
new XColor("lightslateblue", 132, 112, 255),
new XColor("lightslategray", 119, 136, 153),
new XColor("lightslategrey", 119, 136, 153),
new XColor("lightsteelblue", 176, 196, 222),
new XColor("lightsteelblue1", 202, 225, 255),
new XColor("lightsteelblue2", 188, 210, 238),
new XColor("lightsteelblue3", 162, 181, 205),
new XColor("lightsteelblue4", 110, 123, 139),
new XColor("lightyellow", 255, 255, 224),
new XColor("lightyellow1", 255, 255, 224),
new XColor("lightyellow2", 238, 238, 209),
new XColor("lightyellow3", 205, 205, 180),
new XColor("lightyellow4", 139, 139, 122),
new XColor("lime green", 50, 205, 50),
new XColor("limegreen", 50, 205, 50),
new XColor("linen", 250, 240, 230),
new XColor("magenta", 255, 0, 255),
new XColor("magenta1", 255, 0, 255),
new XColor("magenta2", 238, 0, 238),
new XColor("magenta3", 205, 0, 205),
new XColor("magenta4", 139, 0, 139),
new XColor("maroon", 176, 48, 96),
new XColor("maroon1", 255, 52, 179),
new XColor("maroon2", 238, 48, 167),
new XColor("maroon3", 205, 41, 144),
new XColor("maroon4", 139, 28, 98),
new XColor("medium aquamarine", 102, 205, 170),
new XColor("medium blue", 0, 0, 205),
new XColor("medium orchid", 186, 85, 211),
new XColor("medium purple", 147, 112, 219),
new XColor("medium sea green", 60, 179, 113),
new XColor("medium slate blue", 123, 104, 238),
new XColor("medium spring green", 0, 250, 154),
new XColor("medium turquoise", 72, 209, 204),
new XColor("medium violet red", 199, 21, 133),
new XColor("mediumaquamarine", 102, 205, 170),
new XColor("mediumblue", 0, 0, 205),
new XColor("mediumorchid", 186, 85, 211),
new XColor("mediumorchid1", 224, 102, 255),
new XColor("mediumorchid2", 209, 95, 238),
new XColor("mediumorchid3", 180, 82, 205),
new XColor("mediumorchid4", 122, 55, 139),
new XColor("mediumpurple", 147, 112, 219),
new XColor("mediumpurple1", 171, 130, 255),
new XColor("mediumpurple2", 159, 121, 238),
new XColor("mediumpurple3", 137, 104, 205),
new XColor("mediumpurple4", 93, 71, 139),
new XColor("mediumseagreen", 60, 179, 113),
new XColor("mediumslateblue", 123, 104, 238),
new XColor("mediumspringgreen", 0, 250, 154),
new XColor("mediumturquoise", 72, 209, 204),
new XColor("mediumvioletred", 199, 21, 133),
new XColor("midnight blue", 25, 25, 112),
new XColor("midnightblue", 25, 25, 112),
new XColor("mint cream", 245, 255, 250),
new XColor("mintcream", 245, 255, 250),
new XColor("misty rose", 255, 228, 225),
new XColor("mistyrose", 255, 228, 225),
new XColor("mistyrose1", 255, 228, 225),
new XColor("mistyrose2", 238, 213, 210),
new XColor("mistyrose3", 205, 183, 181),
new XColor("mistyrose4", 139, 125, 123),
new XColor("moccasin", 255, 228, 181),
new XColor("navajo white", 255, 222, 173),
new XColor("navajowhite", 255, 222, 173),
new XColor("navajowhite1", 255, 222, 173),
new XColor("navajowhite2", 238, 207, 161),
new XColor("navajowhite3", 205, 179, 139),
new XColor("navajowhite4", 139, 121, 94),
new XColor("navy", 0, 0, 128),
new XColor("navy blue", 0, 0, 128),
new XColor("navyblue", 0, 0, 128),
new XColor("old lace", 253, 245, 230),
new XColor("oldlace", 253, 245, 230),
new XColor("olive drab", 107, 142, 35),
new XColor("olivedrab", 107, 142, 35),
new XColor("olivedrab1", 192, 255, 62),
new XColor("olivedrab2", 179, 238, 58),
new XColor("olivedrab3", 154, 205, 50),
new XColor("olivedrab4", 105, 139, 34),
new XColor("orange", 255, 165, 0),
new XColor("orange red", 255, 69, 0),
new XColor("orange1", 255, 165, 0),
new XColor("orange2", 238, 154, 0),
new XColor("orange3", 205, 133, 0),
new XColor("orange4", 139, 90, 0),
new XColor("orangered", 255, 69, 0),
new XColor("orangered1", 255, 69, 0),
new XColor("orangered2", 238, 64, 0),
new XColor("orangered3", 205, 55, 0),
new XColor("orangered4", 139, 37, 0),
new XColor("orchid", 218, 112, 214),
new XColor("orchid1", 255, 131, 250),
new XColor("orchid2", 238, 122, 233),
new XColor("orchid3", 205, 105, 201),
new XColor("orchid4", 139, 71, 137),
new XColor("pale goldenrod", 238, 232, 170),
new XColor("pale green", 152, 251, 152),
new XColor("pale turquoise", 175, 238, 238),
new XColor("pale violet red", 219, 112, 147),
new XColor("palegoldenrod", 238, 232, 170),
new XColor("palegreen", 152, 251, 152),
new XColor("palegreen1", 154, 255, 154),
new XColor("palegreen2", 144, 238, 144),
new XColor("palegreen3", 124, 205, 124),
new XColor("palegreen4", 84, 139, 84),
new XColor("paleturquoise", 175, 238, 238),
new XColor("paleturquoise1", 187, 255, 255),
new XColor("paleturquoise2", 174, 238, 238),
new XColor("paleturquoise3", 150, 205, 205),
new XColor("paleturquoise4", 102, 139, 139),
new XColor("palevioletred", 219, 112, 147),
new XColor("palevioletred1", 255, 130, 171),
new XColor("palevioletred2", 238, 121, 159),
new XColor("palevioletred3", 205, 104, 137),
new XColor("palevioletred4", 139, 71, 93),
new XColor("papaya whip", 255, 239, 213),
new XColor("papayawhip", 255, 239, 213),
new XColor("peach puff", 255, 218, 185),
new XColor("peachpuff", 255, 218, 185),
new XColor("peachpuff1", 255, 218, 185),
new XColor("peachpuff2", 238, 203, 173),
new XColor("peachpuff3", 205, 175, 149),
new XColor("peachpuff4", 139, 119, 101),
new XColor("peru", 205, 133, 63),
new XColor("pink", 255, 192, 203),
new XColor("pink1", 255, 181, 197),
new XColor("pink2", 238, 169, 184),
new XColor("pink3", 205, 145, 158),
new XColor("pink4", 139, 99, 108),
new XColor("plum", 221, 160, 221),
new XColor("plum1", 255, 187, 255),
new XColor("plum2", 238, 174, 238),
new XColor("plum3", 205, 150, 205),
new XColor("plum4", 139, 102, 139),
new XColor("powder blue", 176, 224, 230),
new XColor("powderblue", 176, 224, 230),
new XColor("purple", 160, 32, 240),
new XColor("purple1", 155, 48, 255),
new XColor("purple2", 145, 44, 238),
new XColor("purple3", 125, 38, 205),
new XColor("purple4", 85, 26, 139),
new XColor("red", 255, 0, 0),
new XColor("red1", 255, 0, 0),
new XColor("red2", 238, 0, 0),
new XColor("red3", 205, 0, 0),
new XColor("red4", 139, 0, 0),
new XColor("rosy brown", 188, 143, 143),
new XColor("rosybrown", 188, 143, 143),
new XColor("rosybrown1", 255, 193, 193),
new XColor("rosybrown2", 238, 180, 180),
new XColor("rosybrown3", 205, 155, 155),
new XColor("rosybrown4", 139, 105, 105),
new XColor("royal blue", 65, 105, 225),
new XColor("royalblue", 65, 105, 225),
new XColor("royalblue1", 72, 118, 255),
new XColor("royalblue2", 67, 110, 238),
new XColor("royalblue3", 58, 95, 205),
new XColor("royalblue4", 39, 64, 139),
new XColor("saddle brown", 139, 69, 19),
new XColor("saddlebrown", 139, 69, 19),
new XColor("salmon", 250, 128, 114),
new XColor("salmon1", 255, 140, 105),
new XColor("salmon2", 238, 130, 98),
new XColor("salmon3", 205, 112, 84),
new XColor("salmon4", 139, 76, 57),
new XColor("sandy brown", 244, 164, 96),
new XColor("sandybrown", 244, 164, 96),
new XColor("sea green", 46, 139, 87),
new XColor("seagreen", 46, 139, 87),
new XColor("seagreen1", 84, 255, 159),
new XColor("seagreen2", 78, 238, 148),
new XColor("seagreen3", 67, 205, 128),
new XColor("seagreen4", 46, 139, 87),
new XColor("seashell", 255, 245, 238),
new XColor("seashell1", 255, 245, 238),
new XColor("seashell2", 238, 229, 222),
new XColor("seashell3", 205, 197, 191),
new XColor("seashell4", 139, 134, 130),
new XColor("sienna", 160, 82, 45),
new XColor("sienna1", 255, 130, 71),
new XColor("sienna2", 238, 121, 66),
new XColor("sienna3", 205, 104, 57),
new XColor("sienna4", 139, 71, 38),
new XColor("sky blue", 135, 206, 235),
new XColor("skyblue", 135, 206, 235),
new XColor("skyblue1", 135, 206, 255),
new XColor("skyblue2", 126, 192, 238),
new XColor("skyblue3", 108, 166, 205),
new XColor("skyblue4", 74, 112, 139),
new XColor("slate blue", 106, 90, 205),
new XColor("slate gray", 112, 128, 144),
new XColor("slate grey", 112, 128, 144),
new XColor("slateblue", 106, 90, 205),
new XColor("slateblue1", 131, 111, 255),
new XColor("slateblue2", 122, 103, 238),
new XColor("slateblue3", 105, 89, 205),
new XColor("slateblue4", 71, 60, 139),
new XColor("slategray", 112, 128, 144),
new XColor("slategray1", 198, 226, 255),
new XColor("slategray2", 185, 211, 238),
new XColor("slategray3", 159, 182, 205),
new XColor("slategray4", 108, 123, 139),
new XColor("slategrey", 112, 128, 144),
new XColor("snow", 255, 250, 250),
new XColor("snow1", 255, 250, 250),
new XColor("snow2", 238, 233, 233),
new XColor("snow3", 205, 201, 201),
new XColor("snow4", 139, 137, 137),
new XColor("spring green", 0, 255, 127),
new XColor("springgreen", 0, 255, 127),
new XColor("springgreen1", 0, 255, 127),
new XColor("springgreen2", 0, 238, 118),
new XColor("springgreen3", 0, 205, 102),
new XColor("springgreen4", 0, 139, 69),
new XColor("steel blue", 70, 130, 180),
new XColor("steelblue", 70, 130, 180),
new XColor("steelblue1", 99, 184, 255),
new XColor("steelblue2", 92, 172, 238),
new XColor("steelblue3", 79, 148, 205),
new XColor("steelblue4", 54, 100, 139),
new XColor("tan", 210, 180, 140),
new XColor("tan1", 255, 165, 79),
new XColor("tan2", 238, 154, 73),
new XColor("tan3", 205, 133, 63),
new XColor("tan4", 139, 90, 43),
new XColor("thistle", 216, 191, 216),
new XColor("thistle1", 255, 225, 255),
new XColor("thistle2", 238, 210, 238),
new XColor("thistle3", 205, 181, 205),
new XColor("thistle4", 139, 123, 139),
new XColor("tomato", 255, 99, 71),
new XColor("tomato1", 255, 99, 71),
new XColor("tomato2", 238, 92, 66),
new XColor("tomato3", 205, 79, 57),
new XColor("tomato4", 139, 54, 38),
new XColor("turquoise", 64, 224, 208),
new XColor("turquoise1", 0, 245, 255),
new XColor("turquoise2", 0, 229, 238),
new XColor("turquoise3", 0, 197, 205),
new XColor("turquoise4", 0, 134, 139),
new XColor("violet", 238, 130, 238),
new XColor("violet red", 208, 32, 144),
new XColor("violetred", 208, 32, 144),
new XColor("violetred1", 255, 62, 150),
new XColor("violetred2", 238, 58, 140),
new XColor("violetred3", 205, 50, 120),
new XColor("violetred4", 139, 34, 82),
new XColor("wheat", 245, 222, 179),
new XColor("wheat1", 255, 231, 186),
new XColor("wheat2", 238, 216, 174),
new XColor("wheat3", 205, 186, 150),
new XColor("wheat4", 139, 126, 102),
new XColor("white", 255, 255, 255),
new XColor("white smoke", 245, 245, 245),
new XColor("whitesmoke", 245, 245, 245),
new XColor("yellow", 255, 255, 0),
new XColor("yellow green", 154, 205, 50),
new XColor("yellow1", 255, 255, 0),
new XColor("yellow2", 238, 238, 0),
new XColor("yellow3", 205, 205, 0),
new XColor("yellow4", 139, 139, 0),
new XColor("yellowgreen", 154, 205, 5)
};
}