I would like to associate a JPanel with a value. This is in a visual way. For that the idea i had in mind is to have half of the JPanel set with a colour if the value is 50%, 1/4th set if value is 25% and so on. These are small JPanels grouped together to form a grid. So the idea is that the user can guess the value of a grid by looking at the percentage area of the panel thats been coloured. Is there such an instance of JPanel/or similar in Swings?
your code worked exquisitely...But i discovered a new problem. Let me explain. Consider a Jpanel to represent the duration of 1 hr. The percentage based design was to shade the Jpanel based on how much of the 1 hr is to be represented. The hitch now is that, it may be required to display several ranges within an hour itself. For example 10:10-10:15, 10:20-10:30, 10:45-10:50. Is there any way to implement this. If nothing works out, i am planning to have a combined shade for all these ranges and provide a mouse tool tip to display the details.
You just need a way to represent the ranges in the hour time period. Use a different color for each, and change the paint() method to change colors as needed. This will be easier if you can specify that no ranges overlap. I would probably create a new class to hold the range information. You can define a maximum number of ranges, an array of colors to use when drawing, add setters and getters for each range that verify they do not overlap, etc... Then, include an instance of the new range class in each panel, and access it in the paint method.
Good luck!
Darrin
Life is good on the Ponderosa,<br />but mind where you step.