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

  Computing the fmin value

Compute the minimum: Graphically, Numerically with the f min search function

  Write down a java application that reads from a text file

give exception handling for opening and reading from the input file. Also, provide exception handling for checking the input file format. Your program must explain to the user the reason for each exception and terminate if one is thrown.

  Discuss information technology profession and ethics

Discuss the Information Technology profession and professional ethics in this profession.How would professional ethics be implemented in an organization.

  Administration, performance for the database

According to you what would be the inherent problems of the database auditing if program was not implemented with the careful thought and consideration? Consider administration, performance, and other factors.

  What are the advantages of using voip

Conduct an Internet search to locate a case study that shows how VoIP was beneficial to the organization.

  Challenges for enterprise system integration

State and discuss the challenges legacy systems pose for the enterprise system integration. Give specific examples in order to support your response.

  What kind of arguments do they take

What types of values do the following modules return, and what type of arguments do they take.

  While design a relational database

What guidelines/steps should you follow as you design a relational database? In addition to using the course material, use the Library to find best-practice guidelines. Be sure to cite your sources.

  Difference between system software and application software

What is difference between system software and application software? How do you find out the operating system version that is installed on your computer.

  Create the class named pizza

build an application named TestPizza that instantiates on Pizza object and demonstrates the use of Pizza set and get methods. Save as TestPizza.java

  Bookstore information management system

State the possible objects in bookstore operation involving their attributes and methods.Recognize the possible use cases and actors.

  Design and populate tables within a database

Employees all have employee ID's, first names, last names, middle initials, street addresses, city, state, postal codes, and a date of birth.

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