Java Code Examples for java.awt.Color#GREEN

The following examples show how to use java.awt.Color#GREEN . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@ConfigItem(
	position = 3,
	keyName = "hexColorFullTrap",
	name = "Full trap",
	description = "Color of full trap timer",
	titleSection = "colorsTitle"
)
default Color getFullTrapColor()
{
	return Color.GREEN;
}
 
Example 2
public static void main(final String[] args) throws AWTException {
    final Window window = new BackgroundIsNotUpdated(null);
    window.setSize(300, 300);
    window.setLocationRelativeTo(null);
    window.setVisible(true);
    sleep();
    window.setBackground(Color.GREEN);
    sleep();
    final Robot robot = new Robot();
    robot.setAutoDelay(200);
    Point point = window.getLocationOnScreen();
    Color color = robot.getPixelColor(point.x + window.getWidth() / 2,
                                      point.y + window.getHeight() / 2);
    window.dispose();
    if (!color.equals(Color.GREEN)) {
        throw new RuntimeException(
                "Expected: " + Color.GREEN + " , Actual: " + color);
    }
}
 
Example 3
public void setColorRGB(String color) {
	String c = color.toLowerCase();
	if (c.equals("white")) {
		this.color = Color.WHITE;
	} else if (c.equals("black")) {
		this.color = Color.BLACK;
	} else if (c.equals("blue")) {
		this.color = Color.BLUE;
	} else if (c.equals("green")) {
		this.color = Color.GREEN;
	} else if (c.equals("magenta")) {
		this.color = Color.MAGENTA;
	} else if (c.equals("orange")) {
		this.color = Color.ORANGE;
	} else if (c.equals("red")) {
		this.color = Color.RED;
	} else if (c.equals("yellow")) {
		this.color = Color.YELLOW;
	}
}
 
Example 4
Source Project: netbeans   File: ColorComboBox.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * C'tor
 * The combo box is initialized with some basic colors and user can also
 * pick a custom color
 */
public ColorComboBox() {
    this( new Color[] {
        Color.BLACK,
        Color.BLUE,
        Color.CYAN,
        Color.DARK_GRAY,
        Color.GRAY,
        Color.GREEN,
        Color.LIGHT_GRAY,
        Color.MAGENTA,
        Color.ORANGE,
        Color.PINK,
        Color.RED,
        Color.WHITE,
        Color.YELLOW,
        }, new String[0], true);
}
 
Example 5
Source Project: unitime   File: PDFPrinter.java    License: Apache License 2.0 5 votes vote down vote up
public Color getColor() {
	if ("green".equals(iColor)) return Color.GREEN;
	if ("red".equals(iColor)) return Color.RED;
	if ("blue".equals(iColor)) return Color.BLUE;
	if ("black".equals(iColor)) return Color.BLACK;
	try {
		return hasColor() ? new Color(Integer.parseInt(iColor,16)) : Color.BLACK; 
	} catch (Exception e) {
		e.printStackTrace();
		return Color.BLACK;
	}
}
 
Example 6
public void doTestSameFormats(MediaProfileSpecType mediaProfileSpecType,
    String expectedVideoCodec, String expectedAudioCodec, String extension) throws Exception {
  String[] mediaUrls = { getPlayerUrl("/video/10sec/red.webm"),
      getPlayerUrl("/video/10sec/green.webm"), getPlayerUrl("/video/10sec/red.webm") };
  Color[] expectedColors = { Color.RED, Color.GREEN, Color.RED };

  doTest(mediaProfileSpecType, expectedVideoCodec, expectedAudioCodec, extension, mediaUrls,
      expectedColors);
}
 
Example 7
@ConfigItem(
	position = 1,
	keyName = "colorTunnel",
	name = "Tunnel Color",
	description = "Color for tunnels with herbiboars",
	titleSection = "colorsTitle"
)
default Color getTunnelColor()
{
	return Color.GREEN;
}
 
Example 8
public void paintComponent(Graphics g){
	Graphics2D g2 = (Graphics2D) g;
	ring1 = new Circle2D(150, 150, 100);
	ring2 = new Circle2D(250, 150, 100);
	ring3 = new Circle2D(200, 230, 100);
	
	g2.setColor(Color.BLACK);
	ring1.draw(g2);
	ring2.draw(g2);
	ring3.draw(g2);
	
	ArrayList<CirculinearContour2D> rings = new ArrayList<CirculinearContour2D>(3);
	rings.add(ring1);
	rings.add(ring2);
	rings.add(ring3);

	Color[] colors = new Color[]{
			Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.ORANGE};
	int i= 0;

	g2.setColor(Color.BLUE);
	for(CirculinearContour2D cont :
		CirculinearCurves2D.splitIntersectingContours(rings)){
		g2.setColor(colors[i++]);
		cont.draw(g2);
	}
}
 
Example 9
Source Project: plugins   File: RaidsTimer.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public Color getTextColor()
{
	if (stopped)
	{
		return Color.GREEN;
	}

	return Color.WHITE;
}
 
Example 10
public static void main(final String[] args) throws Exception {
    robot = new Robot();
    EventQueue.invokeAndWait(DockIconRepaint::createUI);
    try {
        robot.waitForIdle();
        color = Color.BLUE;
        test();
        color = Color.RED;
        test();
        color = Color.GREEN;
        test();
    } finally {
        frame.dispose();
    }
}
 
Example 11
@ConfigItem(
	keyName = "sepulchreHighlightColor",
	name = "Sepulchre Highlight",
	description = "Overlay color for arrows and swords",
	position = 26,
	hidden = true,
	unhide = "highlightSepulchreNpcs",
	titleSection = "colorsTitle"
)
default Color sepulchreHighlightColor()
{
	return Color.GREEN;
}
 
Example 12
@Override
public Color getTextColor()
{
	if (stopped)
	{
		return Color.GREEN;
	}

	return Color.WHITE;
}
 
Example 13
protected RadialGradientPaint getObject() {
    float[] f = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f };
    Color[] c = { Color.BLUE, Color.GREEN, Color.RED, Color.BLUE, Color.GREEN, Color.RED };
    return new RadialGradientPaint(f[0], f[1], f[2], f, c);
}
 
Example 14
protected BevelBorder getObject() {
    return new BevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
}
 
Example 15
public Component getTableCellRendererComponent (
  JTable table, Object pingStatus,
  boolean isSelected, boolean hasFocus,
  int row, int column)
{
  final Color newColor;
  if (pingStatus == null || ! (pingStatus instanceof PingStatus))
    newColor = Color.ORANGE;
  else
    switch ((PingStatus) pingStatus)
    {
      case UNKNOWN:
        newColor = Color.ORANGE;
        break;
      case READY:
        newColor = Color.GREEN;
        break;
      case NOT_READY:
        newColor = Color.RED;
        break;
      default:
        newColor = Color.ORANGE;
        break;
    }
  setBackground (newColor);
  if (this.isBordered)
  {
    if (isSelected)
    {
      if (this.selectedBorder == null)
      {
        this.selectedBorder = BorderFactory.createMatteBorder (2, 5, 2, 5, table.getSelectionBackground ());
      }
      setBorder (this.selectedBorder);
    }
    else
    {
      if (this.unselectedBorder == null)
      {
        this.unselectedBorder = BorderFactory.createMatteBorder (2, 5, 2, 5, table.getBackground ());
      }
      setBorder (this.unselectedBorder);
    }
  }
  return this;
}
 
Example 16
@Override
public Dimension render(Graphics2D graphics)
{
	List<RockRespawn> respawns = plugin.getRespawns();
	if (respawns.isEmpty())
	{
		return null;
	}

	Instant now = Instant.now();
	for (RockRespawn rockRespawn : respawns)
	{
		LocalPoint loc = LocalPoint.fromWorld(client, rockRespawn.getWorldPoint());
		if (loc == null)
		{
			continue;
		}

		float percent = (now.toEpochMilli() - rockRespawn.getStartTime().toEpochMilli()) / (float) rockRespawn.getRespawnTime();
		Point point = Perspective.localToCanvas(client, loc, client.getPlane(), rockRespawn.getZOffset());
		if (point == null || percent > 1.0f)
		{
			continue;
		}

		Rock rock = rockRespawn.getRock();

		// Only draw timer for veins on the same level in motherlode mine
		LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
		if (rock == Rock.ORE_VEIN && isUpstairsMotherlode(localLocation) != isUpstairsMotherlode(loc))
		{
			continue;
		}

		Color pieFillColor = Color.YELLOW;
		Color pieBorderColor = Color.ORANGE;

		// Recolour pie on motherlode veins or Lovakite ore during the portion of the timer where they may respawn
		if ((rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD)
			|| (rock == Rock.DAEYALT_ESSENCE && percent > DAEYALT_RANDOM_PERCENT_THRESHOLD)
			|| (rock == Rock.LOVAKITE && percent > LOVAKITE_ORE_RANDOM_PERCENT_THRESHOLD))
		{
			pieFillColor = Color.GREEN;
			pieBorderColor = DARK_GREEN;
		}

		ProgressPieComponent ppc = new ProgressPieComponent();
		ppc.setBorderColor(pieBorderColor);
		ppc.setFill(pieFillColor);
		ppc.setPosition(point);
		ppc.setProgress(percent);
		ppc.render(graphics);
	}
	return null;
}
 
Example 17
protected RadialGradientPaint getObject() {
    float[] f = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f };
    Color[] c = { Color.BLUE, Color.GREEN, Color.RED, Color.BLUE, Color.GREEN, Color.RED };
    return new RadialGradientPaint(f[0], f[1], f[2], f, c);
}
 
Example 18
protected BevelBorder getObject() {
    return new BevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
}
 
Example 19
@Test
public void agnosticRtpEndpointToWebRtcWithFfmpeg() throws Exception {

  final CountDownLatch proccessOfferLatch = new CountDownLatch(1);

  // Media Pipeline
  MediaPipeline mp = kurentoClient.createMediaPipeline();
  SDES sdes = new SDES();
  sdes.setCrypto(CryptoSuite.AES_128_CM_HMAC_SHA1_80);
  RtpEndpoint rtpEp = new RtpEndpoint.Builder(mp).withCrypto(sdes).build();
  WebRtcEndpoint webRtcEp = new WebRtcEndpoint.Builder(mp).build();

  final CountDownLatch flowingInLatch = new CountDownLatch(1);

  webRtcEp.addMediaFlowInStateChangeListener(new EventListener<MediaFlowInStateChangeEvent>() {

    @Override
    public void onEvent(MediaFlowInStateChangeEvent event) {
      flowingInLatch.countDown();
    }
  });

  rtpEp.connect(webRtcEp);

  getPage().subscribeEvents("playing");
  getPage().initWebRtc(webRtcEp, WebRtcChannel.AUDIO_AND_VIDEO, WebRtcMode.RCV_ONLY);

  String sdp = "v=0\r\n" + "o=- 0 0 IN IP4 0.0.0.0\r\n" + "s=-\r\n" + "t=0 0\r\n"
      + "m=video 1 RTP/SAVP 96\r\n" + "c=IN IP4 0.0.0.0\r\n" + "a=rtpmap:96 H264/90000\r\n"
      + "a=fmtp:96 packetization-mode=1\r\n"
      + "a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:ZDJ4Ump3N0xtRTg0V0k4OWJNaXpKRFl3ejZ0QVJW";

  rtpEp.processOffer(sdp, new Continuation<String>() {

    @Override
    public void onSuccess(String result) throws Exception {
      String[] parse = result.split("m=video");
      String port_ = parse[1].split(" ")[1];
      port = port_;
      proccessOfferLatch.countDown();
    }

    @Override
    public void onError(Throwable cause) throws Exception {
      log.debug("Error:{}", cause.getMessage());
    }
  });

  proccessOfferLatch.await(getPage().getTimeout(), TimeUnit.SECONDS);

  String[] kmsUriParse = kms.getWsUri().split("//");
  String kmsIp = kmsUriParse[1].split(":")[0];

  String mediaPath = FILE + "://" + getTestFilesDiskPath() + "/video/30sec/rgb.mp4";
  String ffmpegCmd = "ffmpeg -re -i " + mediaPath
      + " -an -vcodec libx264 -profile:v baseline -level 3.0 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params ZDJ4Ump3N0xtRTg0V0k4OWJNaXpKRFl3ejZ0QVJW srtp://"
      + kmsIp + ":" + port;

  log.debug("Media Path: {}", mediaPath);
  log.debug("Uri: {}:{}", kmsIp, port);
  log.debug("Ffmpeg cmd: {}", ffmpegCmd);

  Shell.run(ffmpegCmd.split(" "));

  Assert.assertTrue("Not received FLOWING IN event in webRtcEp:",
      flowingInLatch.await(getPage().getTimeout(), TimeUnit.SECONDS));

  Assert.assertTrue("Not received media (timeout waiting playing event)",
      getPage().waitForEvent("playing"));

  Color[] expectedColors = { Color.RED, Color.GREEN, Color.BLUE };
  for (Color expectedColor : expectedColors) {
    Assert.assertTrue("The color of the video should be " + expectedColor,
        getPage().similarColor(expectedColor));
  }

  mp.release();
}
 
Example 20
public DisplaySingle() {
    super();
    lcdValue = 0.0;
    lcdMinValue = 0.0;
    lcdMaxValue = 100.0;
    lcdThreshold = 0.0;
    lcdThresholdVisible = false;
    lcdThresholdBehaviourInverted = false;
    lcdBackgroundVisible = true;
    lcdTextVisible = true;
    lcdBlinking = false;
    LCD_BLINKING_TIMER = new Timer(500, this);
    lcdDecimals = 1;
    lcdUnitString = "unit";
    lcdUnitStringVisible = true;
    lcdScientificFormat = false;
    digitalFont = false;
    useCustomLcdUnitFont = false;
    lcdInfoString = "";
    customLcdUnitFont = new Font("Verdana", 0, 24);
    LCD_STANDARD_FONT = new Font("Verdana", 0, 24);
    LCD_DIGITAL_FONT = Util.INSTANCE.getDigitalFont().deriveFont(24).deriveFont(Font.PLAIN);
    lcdInfoFont = new Font("Verdana", 0, 24);
    numberSystem = NumberSystem.DEC;
    DISABLED_COLOR = new Color(102, 102, 102, 178);
    timeline = new Timeline(this);
    EASING = new org.pushingpixels.trident.ease.Linear();
    sectionsVisible = false;
    sections = new ArrayList<Section>(3);
    sectionsBackground = new ArrayList<BufferedImage>(3);
    sectionsForeground = new ArrayList<Color>(3);
    qualityOverlayVisible = false;
    overlayCornerRadius = 0;
    overlayFactor = 0;
    factor = 0;
    overlayInsets = new Insets(6, 6, 6, 6);
    overlayColors = new Color[]{ Color.RED, Color.RED.darker(), Color.RED };
    qualityOverlayFractions = new float[] { 0.0f, 0.2f, 0.5f, 0.75f, 0.9f, 1.0f };
    qualityOverlayColors = new Color[] { Color.RED, Color.RED, Color.ORANGE, Color.YELLOW, Color.GREEN, Color.GREEN };
    qualityOverlayLookup = new GradientWrapper(new Point2D.Double(INNER_BOUNDS.getBounds2D().getMinX(), 0), new Point2D.Double(INNER_BOUNDS.getMaxX(), 0), qualityOverlayFractions, qualityOverlayColors);
    qualityOverlayGradient = new LinearGradientPaint(new Point2D.Double(0, 2), new Point2D.Double(0, INNER_BOUNDS.height - 2), new float[]{0.0f, 0.5f, 1.0f}, new Color[]{Color.RED, Color.RED.darker(), Color.RED});
    qualityOverlay = new RoundRectangle2D.Double();
    glowVisible = false;
    glowColor = new Color(51, 255, 255);
    glowing = false;
    bargraphVisible = false;
    bargraph = new ArrayList<Shape>(20);
    bargraphSegmentFactor = 0.2;
    plainBargraphSegments = true;
    lcdNnumericValues = true;
    lcdText = "";
    lcdTextX = 0f;
    TEXT_SCROLLER = new Timer(10, this);
    init(INNER_BOUNDS.width, INNER_BOUNDS.height);
    addComponentListener(COMPONENT_LISTENER);
}