Program in java that identifies the color underneath

Assignment Help Computer Engineering
Reference no: EM13322769

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

Reference no: EM13322769

Questions Cloud

What is her height above the river at her lowest point : Your adventurous friend Lola goes bungee jumping. She leaps from a bridge that is 100 m above a river. WHat is her height above the river at her lowest point
Construct e-r diagram for a car insurance company : Construct E-R diagram for a car insurance company whose customers own one car or more cars each. Each car with it zero to any number of recorded accidents.
Write program using array that asks user to input 10 numbers : Write a program using array that asks user to input 10 numbers, then calculates the average of those numbers and finds out the total number that is greater or equal to the average.
Explain the orbitals is the same in a multielectron atom : The arrangement of the orbitals is the same in a multielectron atom and a single-electron atom. In the Li atom, the 3s, 3p, and 3d orbitals have different energies. The He atom has one electron each in 1s and 2s orbitals.
Program in java that identifies the color underneath : 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.
Declare a 1-dimensional array of integers : In pseudocode and in C code, declare a 1-dimensional array of Integers called InternetHits that will hold up to 10 Integer values representing the number of hits a Web site receives.
Explain aqueous solution containing sodium iodide : Iodine is prepared both in the laboratory and commercially by adding Cl2(g) to an aqueous solution containing sodium iodide: 2NaI(aq) +Cl2(g) arrow I2(s) +2NaCl(aq) How grams of iodide, NaI, must be used to produce 55.6 g of iodine, I2
Find counter examples to each of these statements : if a = b(mod m) and c=d(mod m); a,b,c,d,m are integers; c,d>0 and m=> 2, then a^c = b^d(mod m)[note: every = should be triple equal]
Write a code using greedy best first search : Write a code using Greedy Best First Search and A* in Java language to find the shortest path in Romania path to Bucharest

Reviews

Write a Review

Computer Engineering Questions & Answers

  Defining the class counter

Write down the definition of the class counter consisting of: An instance variable named counter of type int. A constructor which takes one int argument and allocates its value to the counter.

  Describe the behaviour of the delete operation

What changes will you make to the above axioms in order to carry out the other two types of deletion discussed in class.

  Define five properties of controls

Are Integers and Strings considered objects in VB? Elaborate.

  Explain what is an xml element

How can I make my existing HTML files work with XML?explain What is an XML element.

  Program to calculate salary of family members

Suppose that your family has 10 members. Suppose further that every family member has the particular amount of the savings. Your task is to find: The total amount of savings that the family has, as a whole and To find who has the largest savings.

  In what order would you complete the tasks

You are sitting at your desk entering charges for a patient when you receive a call from the front desk. Patient Angela Diaz has just been seen by the doctor, and she is in the process of checking out.  She needs to schedule two appointments.

  What are the long-term problems

Business requirements are enforced by implementing database constraints on column and stables.What are the long-term problems?

  Define the three way tcp/ip handshake in connection setup

Come up with a diagram and explain the three way TCP/IP handshake in connection setup and the 3 way TCP/IP handshake in connection release.

  What is the round number when the system becomes idle

Explain why worst-case fair WFQ can have the absolute fairness bound and what is the round number when the system becomes idle? When the system is idle? Justify your answer.

  Create a class named package with data fields for weight

Create a class named Package with data fields for weight in ounces (oz.), shipping method, and shipping cost.

  Listing all the visual basic looping

Listing all the visual basic looping and decision constructs that you think you would need to write a program that sorts the grades for you. DO NOT write the program, simply list the constructs and justify the decision for choosing them.

  Why you believe your solution would solve two mens problem

Consider this scenario: Mr. Brown and Mr. Green have argued several times about which one of them has the slowest horse. They have swapped stories, each telling of the races his horse has lost, but each man also has failed to convince the other th..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd