LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2008, 06:57 PM   #1
joegumbo
Member
 
Registered: Sep 2006
Distribution: MX-16 Modified using TDE
Posts: 239

Rep: Reputation: 32
Java g.setColor not working(SOLVED!!)


Hi,

I'm running Sun's JDK 1.6.0_07 on Slackware 12.1 with all patches and updates applied.

I'm trying to get this assignment to work, but I keep receiving errors with my first g.setColor.

Quote:
import javax.swing.JApplet;
import java.awt.Graphics;
import java.awt.Graphics.*;
import java.awt.Color;


public class CIT130Assign3 extends JApplet
{//begin class

Color myGreen;


public void init( )
{//begin method
myGreen=new Color(38,144,96);
}//end method


public void paint (Graphics g)
{//begin method

super.paint(g);

//draw tires
g.fillOval(80,400,40,40);
g.fillOval(240,400,40,40);


//draw bottom of truck
g.setColor=(myGreen);
Never mind... i found the error...

Not
Quote:
g.setColor=(myGreen);
but
Quote:
g.setColor(myGreen);
Thanks anyhow,
-Joe

Last edited by joegumbo; 10-27-2008 at 12:01 AM. Reason: Found error myself
 
Old 10-26-2008, 04:41 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
//Removing from zero replies.

Two things: firstly, don't write Java as "JAVA" - it's not an acronym, so shouldn't be capitalised. Secondly, don't assume that the mods will read your post; you will need to report them if you want action taken upon them (this is moot anyway, since LQ doesn't usually delete posts).
 
Old 10-27-2008, 12:25 AM   #3
joegumbo
Member
 
Registered: Sep 2006
Distribution: MX-16 Modified using TDE
Posts: 239

Original Poster
Rep: Reputation: 32
Thank you for your advice, Nylex. I've altered my above post as much as possible to comply.
 
Old 10-27-2008, 12:38 AM   #4
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
The setColor method is getting outdated, by the way. Nowadays, you'd use g2d and setPaint and you'd find that you gain a lot of flexibility.
 
Old 10-27-2008, 12:56 AM   #5
joegumbo
Member
 
Registered: Sep 2006
Distribution: MX-16 Modified using TDE
Posts: 239

Original Poster
Rep: Reputation: 32
Hi jay73,

I've been Googling setPaint and g2d online on your recommendation and I see the potential. But, for now I should use the methods demonstrated in class for assignments.

Besides, my specialization is going to be networking anyhow

Thanks,
-Joe

Last edited by joegumbo; 10-27-2008 at 05:17 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Plugin not working - Iceweasel 2.0.0.3, Java RE 1.6.0.01 Brian Ryans Linux - Software 7 05-11-2007 02:40 PM
Java/Firefox java plugin not working with HP Webjetadmin iamskykid Linux - Software 2 03-02-2006 02:38 PM
java working, java plugin not provkitir *BSD 3 01-12-2005 05:49 PM
Web start java not working (java works fine) powadha Debian 5 06-05-2004 12:57 PM
Java not working bwaynej2002 Linux - Software 1 09-06-2003 12:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration