當前位置: 首頁>>代碼示例>>Java>>正文


Java Color.green方法代碼示例

本文整理匯總了Java中java.awt.Color.green方法的典型用法代碼示例。如果您正苦於以下問題:Java Color.green方法的具體用法?Java Color.green怎麽用?Java Color.green使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.Color的用法示例。


在下文中一共展示了Color.green方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createTestImage

import java.awt.Color; //導入方法依賴的package包/類
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:ConcurrentWritingTest.java

示例2: getEntityColor

import java.awt.Color; //導入方法依賴的package包/類
public Color getEntityColor() {
	if ((entity instanceof EntityAnimal)) {
		return Color.white;
	}
	if ((entity instanceof EntityMob)) {
		return Color.red;
	}
	if ((entity instanceof EntitySlime)) {
		return Color.green;
	}
	if ((entity instanceof EntityVillager)) {
		return new Color(245, 245, 220);
	}
	if ((entity instanceof EntityBat)) {
		return Color.BLACK;
	}
	if ((entity instanceof EntitySquid)) {
		return Color.PINK;
	}
	return Color.white;
}
 
開發者ID:Moudoux,項目名稱:EMC,代碼行數:22,代碼來源:IEntity.java

示例3: getNodeColor

import java.awt.Color; //導入方法依賴的package包/類
public Color getNodeColor(int nodeID) {
    boolean c = collapsedNodes.contains(nodeID);
    boolean a = collapsedAttributes.contains(nodeID);
    if (c) {
        if (a)
            return Color.green;
        return Color.yellow;
    }
    if (a)
        return Color.cyan;
    return Color.white;
}
 
開發者ID:spetitjean,項目名稱:TuLiPA-frames,代碼行數:13,代碼來源:XMLViewTree.java

示例4: createTestFile

import java.awt.Color; //導入方法依賴的package包/類
private static void createTestFile() {
    int w = 1280;
    int h = 1024;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    try {
        System.out.println("Create test image " + file.getAbsolutePath());
        boolean b = ImageIO.write(img, "JPEG", file);
        if (!b) {
            throw new RuntimeException("Failed to create test image.");
        }
    } catch (IOException e) {
        throw new RuntimeException("Test failed", e);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:28,代碼來源:ReadingInterruptionTest.java

示例5: doPaint

import java.awt.Color; //導入方法依賴的package包/類
public void doPaint(Graphics2D g2d) {

        g2d.translate(DIM*0.2, DIM*0.2);
        Shape s = new Rectangle2D.Float(0, 0, DIM*2, DIM*2);

        // RadialGradientPaint
        Point2D centre = new Point2D.Float(DIM/2.0f, DIM/2.0f);
        float radius = DIM/2.0f;
        Point2D focus = new Point2D.Float(DIM/3.0f, DIM/3.0f);
        float stops[] = {0.0f, 1.0f};
        Color colors[] =  { Color.red, Color.white} ;

        RadialGradientPaint rgp =
           new RadialGradientPaint(centre, radius, focus, stops, colors,
              RadialGradientPaint.CycleMethod.NO_CYCLE);
        g2d.setPaint(rgp);
        g2d.fill(s);

        g2d.translate(DIM*2.2, 0);
        Color colors1[] =  { Color.red, Color.blue, Color.green} ;
        float stops1[] = {0.0f, 0.5f, 1.0f};
        RadialGradientPaint rgp1 =
           new RadialGradientPaint(centre, radius, focus, stops1, colors1,
              RadialGradientPaint.CycleMethod.REFLECT);
        g2d.setPaint(rgp1);
        g2d.fill(s);

        g2d.translate(-DIM*2.2, DIM*2.2);
        Color colors2[] =  { Color.red, Color.blue, Color.green, Color.white} ;
        float stops2[] = {0.0f, 0.3f, 0.6f, 1.0f};
        RadialGradientPaint rgp2 =
           new RadialGradientPaint(centre, radius, focus, stops2, colors2,
              RadialGradientPaint.CycleMethod.REPEAT);
        g2d.setPaint(rgp2);
        g2d.fill(s);

    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:38,代碼來源:RadialGradientPrintingTest.java

示例6: CandlestickRenderer

import java.awt.Color; //導入方法依賴的package包/類
/**
 * Creates a new renderer for candlestick charts.
 * <P>
 * Use -1 for the candle width if you prefer the width to be calculated automatically.
 *
 * @param candleWidth  the candle width.
 * @param drawVolume  a flag indicating whether or not volume bars should be drawn.
 * @param toolTipGenerator  the tool tip generator. <code>null</code> is none.
 */
public CandlestickRenderer(double candleWidth, boolean drawVolume,
                           XYToolTipGenerator toolTipGenerator) {

    super();
    setToolTipGenerator(toolTipGenerator);
    this.candleWidth = candleWidth;
    this.drawVolume = drawVolume;
    this.upPaint = Color.green;
    this.downPaint = Color.red;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:21,代碼來源:CandlestickRenderer.java

示例7: checkTitleColor

import java.awt.Color; //導入方法依賴的package包/類
/**
  * Check behaviour of method TitledBorder.getTitleColor()
  */
private static void checkTitleColor() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Color defaultColor = UIManager.getLookAndFeelDefaults().getColor("TitledBorder.titleColor");
    Color titledBorderColor = titledBorder.getTitleColor();

    // check default configuration
    if (defaultColor == null) {
        if (titledBorderColor == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default color should be null");
        }
    }
    if (!defaultColor.equals(titledBorderColor)) {
        throw new RuntimeException("L&F default color " + defaultColor.toString()
                                 + " differs from TitledBorder color " + titledBorderColor.toString());
    }

    // title color is explicitly specified
    Color color = Color.green;
    titledBorder.setTitleColor(color);
    if (!color.equals(titledBorder.getTitleColor())) {
        throw new RuntimeException("TitledBorder color should be " + color.toString());
    }

    // title color is unspecified
    titledBorder.setTitleColor(null);
    if (!defaultColor.equals(titledBorder.getTitleColor())) {
        throw new RuntimeException("L&F default color " + defaultColor.toString()
                                 + " differs from TitledBorder color " + titledBorderColor.toString());
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:37,代碼來源:Test7022041.java

示例8: getColor

import java.awt.Color; //導入方法依賴的package包/類
public Color getColor(String color) {
    Matcher match = Pattern.compile("(\\d+), (\\d+), (\\d+)").matcher(color);
    Matcher matchTwo = Pattern.compile("(\\d+)\\s(\\d+)\\s(\\d+)").matcher(color);

    try {
        if (match.find() == true) {
            return new Color(Integer.parseInt(match.group(1)), Integer.parseInt(match.group(2)), Integer.parseInt(match.group(3)));
        } else if (matchTwo.find() == true) {
            return new Color(Integer.parseInt(matchTwo.group(1)), Integer.parseInt(matchTwo.group(2)), Integer.parseInt(matchTwo.group(3)));
        } else {
            switch (color) {
                case "black": return Color.black;
                case "blue": return Color.blue;
                case "cyan": return Color.cyan;
                case "gray": return Color.gray;
                case "green": return Color.green;
                case "magenta": return Color.magenta;
                case "orange": return Color.orange;
                case "pink": return Color.pink;
                case "red": return Color.red;
                case "white": return Color.white;
                case "yellow": return Color.yellow;
                case "dark_green": return Color.green.darker().darker().darker();
                case "light_red": return Color.red.brighter();
                default: return Color.gray;
            }
        }
    } catch (Exception ex) {
        com.gmt2001.Console.err.println("Bad RegEx Sent for getColor: " + ex.getMessage());
        return Color.gray;
    }
}
 
開發者ID:GloriousEggroll,項目名稱:quorrabot,代碼行數:33,代碼來源:DiscordAPI.java

示例9: createChart

import java.awt.Color; //導入方法依賴的package包/類
/**
 * Creates a sample chart.
 * @param dataset  the dataset.
 * @return The chart.
 */
private JFreeChart createChart(CategoryDataset dataset) {
    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart(
        "jaffa.sf.net 2005 Statistics",// chart title
        "Month",                  // domain axis label
        "Hits",                  // range axis label
        dataset,                  // data
        PlotOrientation.VERTICAL, // orientation
        true,                     // include legend
        true,                     // tooltips?
        false                     // URLs?
    );
 
    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
 
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
 
    // get a reference to the plot for further customisation...
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);
 
    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
 
    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
 
    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(
        0.0f, 0.0f, Color.blue,
        0.0f, 0.0f, new Color(0, 0, 64)
    );
    GradientPaint gp1 = new GradientPaint(
        0.0f, 0.0f, Color.green,
        0.0f, 0.0f, new Color(0, 64, 0)
    );
    GradientPaint gp2 = new GradientPaint(
        0.0f, 0.0f, Color.red,
        0.0f, 0.0f, new Color(64, 0, 0)
    );
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);
 
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(
        CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)
    );
    // OPTIONAL CUSTOMISATION COMPLETED.
 
    return chart;
}
 
開發者ID:jaffa-projects,項目名稱:jaffa-framework,代碼行數:64,代碼來源:ImageDom.java

示例10: getProgressBarBorder

import java.awt.Color; //導入方法依賴的package包/類
public static Border getProgressBarBorder() {
    UIDefaults table = UIManager.getLookAndFeelDefaults();
    Border progressBarBorder = new BorderUIResource.LineBorderUIResource(Color.green, 2);
    return progressBarBorder;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:BasicBorders.java

示例11: createDefaultPaintArray

import java.awt.Color; //導入方法依賴的package包/類
/**
 * Convenience method to return an array of <code>Paint</code> objects that represent
 * the pre-defined colors in the <code>Color<code> and <code>ChartColor</code> objects.
 *
 * @return an array of objects with the <code>Paint</code> interface.
 */
public static Paint[] createDefaultPaintArray() {

    return new Paint[] {
        Color.red,
        Color.blue,
        Color.green,
        Color.yellow,
        Color.orange,
        Color.magenta,
        Color.cyan,
        Color.pink,
        Color.gray,
        ChartColor.DARK_RED,
        ChartColor.DARK_BLUE,
        ChartColor.DARK_GREEN,
        ChartColor.DARK_YELLOW,
        ChartColor.DARK_MAGENTA,
        ChartColor.DARK_CYAN,
        Color.darkGray,
        ChartColor.LIGHT_RED,
        ChartColor.LIGHT_BLUE,
        ChartColor.LIGHT_GREEN,
        ChartColor.LIGHT_YELLOW,
        ChartColor.LIGHT_MAGENTA,
        ChartColor.LIGHT_CYAN,
        Color.lightGray,
        ChartColor.VERY_DARK_RED,
        ChartColor.VERY_DARK_BLUE,
        ChartColor.VERY_DARK_GREEN,
        ChartColor.VERY_DARK_YELLOW,
        ChartColor.VERY_DARK_MAGENTA,
        ChartColor.VERY_DARK_CYAN,
        ChartColor.VERY_LIGHT_RED,
        ChartColor.VERY_LIGHT_BLUE,
        ChartColor.VERY_LIGHT_GREEN,
        ChartColor.VERY_LIGHT_YELLOW,
        ChartColor.VERY_LIGHT_MAGENTA,
        ChartColor.VERY_LIGHT_CYAN
    };
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:47,代碼來源:ChartColor.java

示例12: XYDifferenceRenderer

import java.awt.Color; //導入方法依賴的package包/類
/**
 * Creates a new renderer with default attributes.
 */
public XYDifferenceRenderer() {
    this(Color.green, Color.red, false);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:7,代碼來源:XYDifferenceRenderer.java

示例13: XYBoxAndWhiskerRenderer

import java.awt.Color; //導入方法依賴的package包/類
/**
 * Creates a new renderer for box and whisker charts.
 * <P>
 * Use -1 for the box width if you prefer the width to be calculated 
 * automatically.
 *
 * @param boxWidth  the box width.
 */
public XYBoxAndWhiskerRenderer(double boxWidth) {
    super();
    this.boxWidth = boxWidth;
    this.boxPaint = Color.green;
    this.fillBox = true;
    setToolTipGenerator(new BoxAndWhiskerXYToolTipGenerator());
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:16,代碼來源:XYBoxAndWhiskerRenderer.java

示例14: CandlestickRenderer

import java.awt.Color; //導入方法依賴的package包/類
/**
 * Creates a new renderer for candlestick charts.
 * <P>
 * Use -1 for the candle width if you prefer the width to be calculated 
 * automatically.
 *
 * @param candleWidth  the candle width.
 * @param drawVolume  a flag indicating whether or not volume bars should 
 *                    be drawn.
 * @param toolTipGenerator  the tool tip generator. <code>null</code> is 
 *                          none.
 */
public CandlestickRenderer(double candleWidth, boolean drawVolume,
                           XYToolTipGenerator toolTipGenerator) {
    super();
    setToolTipGenerator(toolTipGenerator);
    this.candleWidth = candleWidth;
    this.drawVolume = drawVolume;
    this.upPaint = Color.green;
    this.downPaint = Color.red;
    this.useOutlinePaint = false;  // false preserves the old behaviour
                                   // prior to introducing this flag
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:24,代碼來源:CandlestickRenderer.java

示例15: ScrollerRight

import java.awt.Color; //導入方法依賴的package包/類
public ScrollerRight(int x, int y, boolean visible, int width, int height) {
	super(x, y, visible, Color.green, width, height);

}
 
開發者ID:dviol,項目名稱:Project15,代碼行數:5,代碼來源:ScrollerRight.java


注:本文中的java.awt.Color.green方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。