1. /* ===========================================================
  2. * JFreeChart : a free chart library for the Java(tm) platform
  3. * ===========================================================
  4. *
  5. * (C) Copyright 2000-2004, by Object Refinery Limited and Contributors.
  6. *
  7. * Project Info: http://www.jfree.org/jfreechart/index.html
  8. *
  9. * This library is free software; you can redistribute it and/or modify it under the terms
  10. * of the GNU Lesser General Public License as published by the Free Software Foundation;
  11. * either version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  14. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License along with this
  18. * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. *
  21. * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  22. * in the United States and other countries.]
  23. *
  24. * ----------------
  25. * GreyPalette.java
  26. * ----------------
  27. * (C) Copyright 2002-2004, by David M. O'Donnell and Contributors.
  28. *
  29. * Original Author: David M. O'Donnell;
  30. * Contributor(s): David Gilbert (for Object Refinery Limited);
  31. *
  32. * $Id: GreyPalette.java,v 1.1 2004/08/31 14:54:21 mungady Exp $
  33. *
  34. * Changes
  35. * -------
  36. * 26-Nov-2002 : Version 1 contributed by David M. O'Donnell (DG);
  37. * 26-Mar-2003 : Implemented Serializable (DG);
  38. *
  39. */
  40. package org.jfree.chart.ui;
  41. import java.io.Serializable;
  42. /**
  43. * A grey color palette.
  44. *
  45. * @author David M. O'Donnell.
  46. */
  47. public class GreyPalette extends ColorPalette implements Serializable {
  48. /**
  49. * Creates a new palette.
  50. */
  51. public GreyPalette() {
  52. super();
  53. initialize();
  54. }
  55. /**
  56. * Intializes the palette's indices.
  57. */
  58. public void initialize() {
  59. setPaletteName("Grey");
  60. this.r = new int[256];
  61. this.g = new int[256];
  62. this.b = new int[256];
  63. this.r[0] = 255;
  64. this.g[0] = 255;
  65. this.b[0] = 255;
  66. this.r[1] = 0;
  67. this.g[1] = 0;
  68. this.b[1] = 0;
  69. for (int i = 2; i < 256; i++) {
  70. this.r[i] = i;
  71. this.g[i] = i;
  72. this.b[i] = i;
  73. }
  74. }
  75. }