当前位置: 首页>>代码示例>>Java>>正文


Java Color.getGreen方法代码示例

本文整理汇总了Java中java.awt.Color.getGreen方法的典型用法代码示例。如果您正苦于以下问题:Java Color.getGreen方法的具体用法?Java Color.getGreen怎么用?Java Color.getGreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Color的用法示例。


在下文中一共展示了Color.getGreen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHtmlColor

import java.awt.Color; //导入方法依赖的package包/类
@NonNull
private static String getHtmlColor(@NullAllowed final Color _c, @NonNull final Color defaultColor) {
    Color c = _c == null ? defaultColor : _c;
    final int r = c.getRed();
    final int g = c.getGreen();
    final int b = c.getBlue();
    final StringBuilder result = new StringBuilder();
    result.append ("#");        //NOI18N
    final String rs = Integer.toHexString (r);
    final String gs = Integer.toHexString (g);
    final String bs = Integer.toHexString (b);
    if (r < 0x10)
        result.append('0');
    result.append(rs);
    if (g < 0x10)
        result.append ('0');
    result.append(gs);
    if (b < 0x10)
        result.append ('0');
    result.append(bs);
    return result.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:SnippetNodes.java

示例2: colorizeNoWhite

import java.awt.Color; //导入方法依赖的package包/类
private ImageIcon colorizeNoWhite(ImageIcon icon, Color color) {
    int[] pixels = new int[icon.getIconHeight() * icon.getIconWidth()];
    try {
        PixelGrabber grabber = new PixelGrabber(icon.getImage(), 0, 0, icon.getIconWidth(),
                                                icon.getIconHeight(), pixels, 0,
                                                icon.getIconWidth());
        grabber.grabPixels();
        int r = color.getRed();
        int g = color.getGreen();
        int b = color.getBlue();

        int pixel;
        for (int i = 0, acm; i < pixels.length; i++) {
        	pixel = pixels[i];
        	int alpha = (pixel >> 24) & 0xff;
            int red   = (pixel >> 16) & 0xff;
            int green = (pixel >>  8) & 0xff;
            int blue  = pixel & 0xff;
            acm = (blue + green + red) / 3;
            int max = 255;
            if (acm < 200) {
                pixels[i] = (((acm * r)/max) << 16) + (((acm * g)/max) << 8) + ((acm * b)/max) + (alpha << 24);
            } else {
                pixels[i] = (acm << 16) + (acm << 8) + acm + (alpha << 24);
            }
        }
    } catch (InterruptedException ex) {
        ex.printStackTrace();
    }
    MemoryImageSource mis = new MemoryImageSource(icon.getIconWidth(),
                                                  icon.getIconHeight(),
                                                  pixels, 0,
                                                  icon.getIconWidth());
    return new ImageIcon(component.createImage(mis));
}
 
开发者ID:adbenitez,项目名称:jNotifyOSD,代码行数:36,代码来源:NotifyConfig.java

示例3: hexString

import java.awt.Color; //导入方法依赖的package包/类
/**
 * 
 */
public static String hexString(Color color) {
  int r = color.getRed();
  int g = color.getGreen();
  int b = color.getBlue();

  return String.format("#%02X%02X%02X", r, g, b);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:11,代码来源:mxHtmlColor.java

示例4: getColorStringDefinition

import java.awt.Color; //导入方法依赖的package包/类
static String getColorStringDefinition(Color color) {
    int r = color.getRed();
    int g = color.getGreen();
    int b = color.getBlue();
    // {r,g,b}
    return "{" + r + "," + g + "," + b + "}";
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:8,代码来源:TikzStylesExtractor.java

示例5: average

import java.awt.Color; //导入方法依赖的package包/类
private static Color average(Color c1, Color c2)
{
	int red = c1.getRed() + (c2.getRed() - c1.getRed()) / 2;
	int green = c1.getGreen() + (c2.getGreen() - c1.getGreen()) / 2;
	int blue = c1.getBlue() + (c2.getBlue() - c1.getBlue()) / 2;
	return new Color(red, green, blue);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:ShadowBorder.java

示例6: matchColor

import java.awt.Color; //导入方法依赖的package包/类
private static boolean matchColor(int[] pixel, Color... colors) {
    boolean match = false;
    for (Color color : colors) {
        match = pixel[0] == color.getRed() && pixel[1] == color.getGreen() && pixel[2] == color.getBlue();
        if (match) {
            break;
        }
    }
    return match;
}
 
开发者ID:BlackCraze,项目名称:GameResourceBot,代码行数:11,代码来源:Preprocessor.java

示例7: INT_ARGBequals

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Compares the RGB values of the two arguments. Note that it does not
 * compare the alpha values!
 * 
 * @param argb argb value from the image
 * @param color the color to compare it with
 * @return true if red, green and blue components are equal, false otherwise
 */
public static boolean INT_ARGBequals(int argb, Color color) {
	int blue = 0x000000FF & argb;
	int green = (0x0000FF00 & argb) >> 8;
	int red = (0x00FF0000 & argb) >> 16;
	//int alpha = (0xFF000000 & argb) >> 24;
	
	return color.getRed() == red &&
		color.getBlue() == blue && 
		color.getGreen() == green;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:19,代码来源:PixelReplacer.java

示例8: findBiggestObjects

import java.awt.Color; //导入方法依赖的package包/类
private String findBiggestObjects(int number) {
    Heap heap = getSummaryController().getHeapFragmentWalker().getHeapFragment();
    List<Instance> bigObjects = heap.getBiggestObjectsByRetainedSize(number);
    StringBuffer output = new StringBuffer();
    JavaClass java_lang_Class = heap.getJavaClassByName(Class.class.getName());
    NumberFormat formatter =  NumberFormat.getInstance();
    boolean oddRow = false;
    Color oddRowBackground = UIUtils.getDarker(
                    UIUtils.getProfilerResultsBackground());
    final String oddRowBackgroundString =
            "rgb(" + oddRowBackground.getRed() + "," + //NOI18N
                     oddRowBackground.getGreen() + "," + //NOI18N
                     oddRowBackground.getBlue() + ")"; //NOI18N
    
    output.append("<table border='0' width='100%'>");  // NOI18N
    output.append("<tr style='background-color:");  // NOI18N
    output.append(oddRowBackgroundString).append(";'>");  // NOI18N
    addHeading(output, Bundle.HintsController_ClassName());
    addHeading(output, Bundle.HintsController_RetainedSize());
    output.append("</tr>"); // NOI18N
    for(Instance in : bigObjects) {
        output.append(oddRow ? "<tr style='background-color: " + // NOI18N
                                  oddRowBackgroundString + ";'>" :  // NOI18N
                                  "<tr>");  // NOI18N
        if (in.getJavaClass().equals(java_lang_Class)) {
            JavaClass javaClass = heap.getJavaClassByID(in.getInstanceId());
            addCell(output,printClass(javaClass), false);
        } else {
            addCell(output,printInstance(in), false);
        }
        addCell(output,formatter.format(in.getRetainedSize()), true);
        output.append("</tr>");   // NOI18N
        oddRow = !oddRow;
    }
    output.append("</table>");   // NOI18N
    return output.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:HintsController.java

示例9: ParsedColor

import java.awt.Color; //导入方法依赖的package包/类
public ParsedColor(Color color, String toString)
{
  super(color.getRed(),
        color.getGreen(),
        color.getBlue(),
        color.getAlpha());

  _toString = toString;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:10,代码来源:Coercions.java

示例10: ShipGraphics

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Create a new ship graphic and specify the ship and the color for the team
 * 
 * @param shipColor
 * @param ship
 */
public ShipGraphics(Ship ship, Color shipColor) {
	super(ship.getRadius(), ship.getRadius());
	this.shipColor = shipColor;
	this.ship = ship;
    this.idColor = new Color(255 - shipColor.getRed(), 255 - shipColor.getGreen(), 255 - shipColor.getBlue());

}
 
开发者ID:CatherineHa,项目名称:Proj4,代码行数:14,代码来源:ShipGraphics.java

示例11: getDetailsString

import java.awt.Color; //导入方法依赖的package包/类
public String getDetailsString(String className, Instance instance, Heap heap) {
    if (FONT_MASK.equals(className)) {                                      // Font+
        String name = Utils.getFontName(instance, heap);
        if (name == null) name = "Default";                                 // NOI18N
        int size = DetailsUtils.getIntFieldValue(instance, "size", 10);     // NOI18N // TODO: should use default font size
        name += ", " + size + "pt";                                         // NOI18N
        int style = DetailsUtils.getIntFieldValue(instance, "style", 0);    // NOI18N
        if ((style & 1) != 0) name += ", bold";                             // NOI18N
        if ((style & 2) != 0) name += ", italic";                           // NOI18N
        return name;
    } else if (COLOR_MASK.equals(className)) {                              // Color+
        Color color = new ColorBuilder(instance, heap).createInstance();
        return color.getRed() + ", " + color.getGreen() +                   // NOI18N
               ", " + color.getBlue() + ", " + color.getAlpha();            // NOI18N
    } else if (POINT_MASK.equals(className)) {                              // Point+
        Point point = new PointBuilder(instance, heap).createInstance();
        return point.x + ", " + point.y;                                    // NOI18N
    } else if (DIMENSION_MASK.equals(className)) {                          // Dimension+
        Dimension dimension = new DimensionBuilder(instance, heap).createInstance();
        return dimension.width + ", " + dimension.height;                   // NOI18N
    } else if (RECTANGLE_MASK.equals(className)) {                          // Rectangle+
        Rectangle rectangle = new RectangleBuilder(instance, heap).createInstance();
        return rectangle.x + ", " + rectangle.y +                           // NOI18N
               ", " + rectangle.width + ", " + rectangle.height;            // NOI18N
    } else if (INSETS_MASK.equals(className)) {                             // Insets+
        Insets insets = new InsetsBuilder(instance, heap).createInstance();
        return insets.top + ", " + insets.left +                            // NOI18N
               ", " + insets.bottom + ", " + insets.right;                  // NOI18N
    } else if (TEXTATTRIBUTE_MASK.equals(className) ||                      // AttributedCharacterIterator$Attribute+
               CURSOR_MASK.equals(className)) {                             // Cursor+
        return DetailsUtils.getInstanceFieldString(
                instance, "name", heap);                                    // NOI18N
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:AwtDetailsProvider.java

示例12: updateMotifColors

import java.awt.Color; //导入方法依赖的package包/类
void updateMotifColors(Color bg) {
    int red = bg.getRed();
    int green = bg.getGreen();
    int blue = bg.getBlue();

    darkShadow = new Color(MotifColorUtilities.calculateBottomShadowFromBackground(red,green,blue));
    lightShadow = new Color(MotifColorUtilities.calculateTopShadowFromBackground(red,green,blue));
    selectColor= new Color(MotifColorUtilities.calculateSelectFromBackground(red,green,blue));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:XComponentPeer.java

示例13: getColorValues

import java.awt.Color; //导入方法依赖的package包/类
public static float[] getColorValues(Color c) {
	return new float[] { c.getRed() / 255f, c.getGreen() / 255f, c.getGreen() / 255f };
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:4,代码来源:RenderUtils.java

示例14: FromSystem

import java.awt.Color; //导入方法依赖的package包/类
public static ColorHEX FromSystem(Color color)
{
	return new ColorHEX((color.getRed() << 16) + (color.getGreen() << 8) + color.getBlue());
}
 
开发者ID:V0idWa1k3r,项目名称:VoidApi,代码行数:5,代码来源:ColorHEX.java

示例15: setColor

import java.awt.Color; //导入方法依赖的package包/类
public static void setColor(Color color) {
	Fog.color = new float[]{color.getRed()/255f, color.getGreen()/255f, color.getBlue()/255f, color.getAlpha()/255f};
}
 
开发者ID:ZetzmannM,项目名称:CGL,代码行数:4,代码来源:Fog.java


注:本文中的java.awt.Color.getGreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。