• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to the custom color in the Java object?

New Here ,
Jul 05, 2007 Jul 05, 2007

Copy link to clipboard

Copied

My code:
<cfset var image = createObject("java","java.awt.image.BufferedImage") />
<cfset var color=createObject("java","java.awt.Color") />
<cfset g = image.getGraphics() />
<cfset g.setColor(color.white) />

In the last row,I want to repalce the "color.white" with #F23ABB,How???
Thanks.
TOPICS
Advanced techniques

Views

392

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Jul 05, 2007 Jul 05, 2007
Try the decode() method and you must initialize the BufferedImage object before using it.
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/BufferedImage.html#BufferedImage(int,%20int,%20int)

<cfset var bi = createObject("java","java.awt.image.BufferedImage") />
<cfset var image = bi.init(theImageWidth, theImageHeight, bi.TYPE_INT_ARGB) />
<cfset var g = image.getGraphics() />
<cfset var color = createObject("java","java.awt.Color") />
<cfset g.setColor(Color.decode("##F23ABB")) />

Votes

Translate

Translate
Guide ,
Jul 05, 2007 Jul 05, 2007

Copy link to clipboard

Copied

Try the decode() method and you must initialize the BufferedImage object before using it.
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/BufferedImage.html#BufferedImage(int,%20int,%...

<cfset var bi = createObject("java","java.awt.image.BufferedImage") />
<cfset var image = bi.init(theImageWidth, theImageHeight, bi.TYPE_INT_ARGB) />
<cfset var g = image.getGraphics() />
<cfset var color = createObject("java","java.awt.Color") />
<cfset g.setColor(Color.decode("##F23ABB")) />

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 06, 2007 Jul 06, 2007

Copy link to clipboard

Copied

LATEST
thanks,it works.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation