当前位置: 首页>>代码示例>>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;未经允许,请勿转载。