Results 1 to 6 of 6

Thread: setColor

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    setColor

    I see where both Graphics object and Image object have a method called setColor.

    So does this set the background or the foreground color and how would I go about using drawString where the color of the string is green and I want to draw this string on a black rectangle?

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: setColor

    set the graphics object color to black, draw your rect, set it to green then draw the string.

    This simple
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: setColor

    Yeah, since I couldn't find anything to tell me one was back color and the other fore color I kind of thought that might be how it is done just didn't know for sure. Thanks.

    BTW

    what is the difference between

    Graphics and Image objects?

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: setColor

    "The abstract class Image is the superclass of all classes that represent graphical images. The image must be obtained in a platform-specific manner. "

    "The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images.

    A Graphics object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties: "
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: setColor

    OK, thanks.

    BTW:

    Are you the only one here? I ask cus you seem to be the only person that ever responds to my questions.

  6. #6
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: setColor

    Java Pros tend to participate in Sun forums. But I like it here
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width