Question:
I have a java programing assignment for csi201.I need to create a method for a color palette.?
anonymous
2008-04-10 20:19:16 UTC
One of the methods will be called createPalette, and will create a digital image that is a color palette. The second method will be a main method that will ask the user for some information, create a picture to use as the palette, and create and display the palette.

For this assignment, you will write a method to create a color palette
The createPalette method takes one integer parameter, which is the blue value for the palette. You may assume that when the method is called, it will be with a value in the range 0 to 255 (i.e. a valid RGB color value). The method will be called on a Picture object. The createPalette method assumes that the Picture is at least 256 pixels in both width and height.The main method you create for this assignment should do four things.

Ask the user for a blue value to use in creating the palette.
Create a new Picture object that is 256x256.
Call the createPalette method on the picture object, passing the blue value parameter the method got from the user.
Display the palette picture.
Three answers:
anonymous
2008-04-10 22:46:45 UTC
The above code is not even 80% correct!!
GW
2008-04-10 21:34:34 UTC
This code should ask the user for a blue value and then display a 256x256 image in a window (I'm not testing the code, so any errors you will have to work through).



If you need an actual colour palette, that shows a range of colors then ask again with that criteria (this only shows 1 solid color in the frame, its not really a "palette");



SOME STUFF GETS CUT OFF, ask again if you dont figure it out! Good luck



import javax.swing.*;

import java.awt.*;

import java.io.*;



public class Palette{

// these are your global variables....

JPanel PictureObject; // this will be your "Picture Object"



// this is your createPalette method

public static void createPalette(int value){

PictureObject.setBackground(new Color(0,0,value)); // R,G,B

JFrame frame = new JFrame("Palette Program!");

// set close operation to JFrame.EXIT_ON_CLOSE

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// add "PictureObject" to frame

frame.getContentPane().add(PictureObject);

frame.pack();

frame.setVisible(true);

}



// this is your main method

public static void main(String[] args){

PictureObject = new JPanel(); // create your picture object

PictureObject.setPreferredSize(new Dimension(256,256));



BufferedReader inputReader = new BufferedReader(new InputStreamReader(System.in)); // create input reader



System.out.print("Enter a value: ");

int value = Integer.parseInt(inputReader.readLine());



// this will set the panel to the color selected

createPalette(value);

}



}
?
2016-10-18 15:24:32 UTC
Oh nicely you have come to the impressive place. right here on the P&S Brothel I Madame Towel have a gorgeous e book on the thank you to do your makeup in keeping with what usa you're prostituteing in or what form of seem you like. extreme type, crack wh***, street walker, call lady, etc. we now have 2 Romanian Hooker seems. a million:extreme type-You prepare a mild blush on your cheeks and attempt a brown eyeshadow. Suck on your cheeks and prepare it gently decrease than the cheekbone to offer your face that solid seem. Then prepare a deep crimson lipstick while you're greater olive and a lighter pink colour while you're greater ivory. next for the eyemakup attempt a golden brown for the eyeshadow and a superb (thinly utilized) black eyeshadow. 2:Trashy nook lady-prepare a awesome crimson blush in a around action onto your cheeks accompanied with a black eyeshadow and heavy black eyeliner (make advantageous it has that smokey seem, and upload slightly too plenty on the backside). Then prepare a awesome crimson lipstick with a pink lipliner. additionally for the greater run down seem activate a fan and placed your hair close to it. Then shake your head all around in a around action. After that colour one in each and every of your front the teeth black with a black sharpie marker.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...