Solved

Creating a Color Class?

Posted on 2008-10-30
2
936 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

627 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