當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。