* Copyright (C) 1997 Sun Microsystems Inc.\r
* All Rights Reserved.\r
*\r
- * Permission to use, copy, modify, and distribute this \r
+ * Permission to use, copy, modify, and distribute this\r
* software and its documentation for NON-COMMERCIAL purposes\r
- * and without fee is hereby granted provided that this \r
- * copyright notice appears in all copies. \r
- * \r
- * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR \r
- * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE \r
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A \r
+ * and without fee is hereby granted provided that this\r
+ * copyright notice appears in all copies.\r
+ *\r
+ * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR\r
+ * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\r
* PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS\r
- * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED \r
- * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING \r
+ * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED\r
+ * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING\r
* THIS SOFTWARE OR ITS DERIVATIVES.\r
*/\r
\r
* @exception IllegalArgumentException if bad format\r
*/\r
\r
+ public static String getHexString(java.awt.Color color)\r
+ {\r
+ String r, g, b;\r
+ r = Integer.toHexString(color.getRed());\r
+ if (r.length() < 2)\r
+ r = "0" + r;\r
+ g = Integer.toHexString(color.getGreen());\r
+ if (g.length() < 2)\r
+ g = "0" + g;\r
+ b = Integer.toHexString(color.getBlue());\r
+ if (b.length() < 2)\r
+ b = "0" + b;\r
+\r
+ return r+g+b;\r
+ }\r
+\r
+\r
public Format(String s) {\r
width = 0;\r
precision = -1;\r
* prints a formatted number following printf conventions\r
* @param s a PrintStream\r
* @param fmt the format string\r
- * @param x the character to \r
+ * @param x the character to\r
*/\r
\r
public static void print(java.io.PrintStream s, String fmt, char x) {\r
/**\r
* Formats a double into a string (like sprintf in C)\r
* @param x the number to format\r
- * @return the formatted string \r
+ * @return the formatted string\r
* @exception IllegalArgumentException if bad argument\r
*/\r
\r
/**\r
* Formats a long integer into a string (like sprintf in C)\r
* @param x the number to format\r
- * @return the formatted string \r
+ * @return the formatted string\r
*/\r
\r
public String form(long x) {\r
/**\r
* Formats a character into a string (like sprintf in C)\r
* @param x the value to format\r
- * @return the formatted string \r
+ * @return the formatted string\r
*/\r
\r
public String form(char c) {\r
/**\r
* Formats a string into a larger string (like sprintf in C)\r
* @param x the value to format\r
- * @return the formatted string \r
+ * @return the formatted string\r
*/\r
\r
public String form(String s) {\r