Results 1 to 3 of 3

Thread: quick question

  1. #1
    Join Date
    Jan 2011
    Posts
    13
    Rep Power
    0

    Default quick question

    Java Code:
    	private void paintInfo(Graphics g) {
    		Graphics2D g2d = (Graphics2D) g;
    		if(plr.isInfo){
    			g2d.drawString("foo1", 100, 105); // Blue
    			g2d.drawString("foo2", 100, 110); // Red
    			g2d.drawString("foo3", 100, 115); // Green
    			g2d.drawString("foo4", 100, 120); // Orange
    		}
    	}
    How do i change the color of an individual string?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by biggerthanblue View Post
    How do i change the color of an individual string?
    You change the color of the Graphics or Graphics2D object via its setColor(Color c) method just prior to drawing the String.

  3. #3
    Join Date
    Jan 2011
    Posts
    13
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    You change the color of the Graphics or Graphics2D object via its setColor(Color c) method just prior to drawing the String.
    Thanks alot!

Similar Threads

  1. Really Quick question
    By Ryan10 in forum New To Java
    Replies: 63
    Last Post: 03-02-2011, 02:11 AM
  2. Quick question
    By Thumper in forum New To Java
    Replies: 10
    Last Post: 11-07-2010, 10:06 PM
  3. Really quick question
    By shadycharacter in forum New To Java
    Replies: 2
    Last Post: 04-22-2010, 10:06 PM
  4. quick question
    By vouslavous in forum Java Applets
    Replies: 4
    Last Post: 04-24-2009, 08:35 PM
  5. Quick Question
    By Graeme in forum New To Java
    Replies: 4
    Last Post: 01-08-2009, 08:01 PM

Posting Permissions

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