Solved

Creating a Color Class?

Posted on 2008-10-30
2
935 Views
Last Modified: 2013-11-23
I have to create a color class called Crayon that represents one crayon of a particular color and lenght/height..and design and implement a program that draws a box of crayons....I have the colors, but how to implement them as colors?

import java.awt.Color;
import javax.swing.JApplet;
import java.awt.*;


public class Crayon extends JApplet
{
   
    public void paint (Graphics page)
           
    {      
 int crayonShapeX[] = { 0, 2, 10, 15, 23, 25, 25, 0 };
 int crayonShapeY[] = { 15, 15, 0, 0, 15, 15, 45, 45 };

  private Color crayonColors[] = {
      Color.blue, Color.cyan, Color.darkGray,
      Color.gray, Color.green, Color.magenta,
      Color.orange, Color.pink, Color.red,
      Color.white, Color.yellow};

  }
}
0
Comment
Question by:April_Denise
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
humanonomics earned 125 total points
ID: 22847852
Can you please re-phrase the question ? It is a bit confusing.
0
 
LVL 5

Expert Comment

by:muktajindal
ID: 22848142
Use desired color by accessing array crayonColors[].
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question