Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

writing a program in JAVA that identifies the color underneath the mouse pointer and fills a JFrame with that color, and displays the RGB values of that color. This is what I have so far:

import java.awt.Component;

import java.awt.event.*;

import java.awt.AWTException;

import java.awt.Color;

import java.awt.MouseInfo;

import java.awt.Point;

import java.awt.PointerInfo;

import java.awt.Robot;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

 

public class FinalProject {

public static void main(String[] args) throws AWTException {

// sets up application window

JFrame frame = new JFrame("Color Blind Assistant");

frame.setVisible(true);

frame.setSize(500,500);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// determines color underneath mouse

PointerInfo cursorLocation = MouseInfo.getPointerInfo();

Point position = cursorLocation.getLocation();

int x = (int)position.getX();

int y = (int)position.getY();


Robot colorfind = new Robot();


Color pixelColor = colorfind.getPixelColor(x, y);

int colorRed = pixelColor.getRed();

int colorGreen = pixelColor.getGreen();

int colorBlue = pixelColor.getBlue();

// sets color of application background

frame.getContentPane().setBackground(pixelColor);

// prints RGB value of color under mouse

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9902071

Have any Question?


Related Questions in Computer Engineering

Calculate the standard gibbs free energy change and the

Calculate the standard Gibbs free energy change and the equilibrium constant for the oxidation of a formate ion to carbon dioxide at pH=7 and room temperature.

Systems and networkscalculate the timeoutinterval for tcp

Systems and Networks Calculate the TimeOutInterval for TCP. Assume the observed SampleRTTs for the first three packets are 2 seconds, 5 seconds, and 8 seconds. The value of a=0.25 and the "safety margin" is 0.5 seconds. ...

Question suppose two matlab functions find-nonzero and

Question : Suppose, two Matlab functions find-nonzero and row-echelon are available to use. The first function takes a vector as input and returns the location of the first nonzero entry of the input vector. The second f ...

What are the minimum and maximum values in decimal if an

What are the minimum and maximum values (in decimal) if an 8-bit binary number is given unsigned and two's complement formats?

The following is historical data on the us dollar -

The following is historical data on the U.S. dollar - Canadian dollar exchange rate: Date U.S./Canadian  Canadian/U.S. 1/20/2016 0.68 1.46 9/6/2018 0.76 1.32 Calculate the percentage change in the exchange rate over this ...

Listen to or read the transcript of this podcast

Listen to (or read the transcript of) this podcast (https://www.stlouisfed.org/education/economic-lowdown-podcast-series/episode-16-elasticity-of-demand) from the Federal Reserve Bank of St. Louis. Describe your experien ...

Assignment - dijkstra algorithmdijkstras algorithm finds

Assignment - Dijkstra Algorithm Dijkstra's algorithm finds the shortest path from a given node to all other nodes. 1) We observe that we can modify this algorithm to stop as soon as a particular node is reached; thus pro ...

With respect to bus request interruptswhat must be allowed

With respect to bus request interrupts: What must be allowed to complete before the interrupts is serviced? What resources (CPU, buses, memory, etc..) is the ISR expected to use? What is the ISR typically expected to do? ...

Bierco is a beer company based in germany you purchased the

BierCo is a beer company based in Germany. You purchased the stock in 2011 for 100 Euros when the exchange rate was 1.4 EUR/ USD. Today BierCo's price is 120 Euros and the exhange rate is 1.12 EUR/USD. What is the dollar ...

Describe a ping of death attack as an attack that causes

Describe a ping of death attack as an attack that causes the victim computer to freeze and malfunction.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As