now i need to know what is a class file and what does it do?
and can anyone suggest any ways i can make the appearance of my applet better, at the moment i am only using the colour cyan which is not very good.
thanks
03-20-2004, 01:13 PM
mikeBarr81
when you write you code you save it as a .java file and it is essentially just plain text that the compiler knows how to compile. When you compile it the compiler turns it into java bytecode which won't resemble your .java file at all but contains all the same information. This is the .class file and when you run your program the jvm takes the java bytecode and interprets it into native machine code that the computer understands.
03-21-2004, 06:14 AM
Phaelax
Depending on what you want to color, you'd have to look up the appropriate class on how to change its color. There are other colors defined in the Color class. Or to define your own color using rgb values:
Color c = new Color(255,0,156)
03-21-2004, 09:56 AM
tarun
apart from changing the color, is there any other "designs"/"patterns" that i could apply to the applet to make it look better.
also when you define the color like this:
Color c = new Color(255,0,156)
how do i apply it?
03-21-2004, 01:24 PM
stefal
Hi Tarun
To use a new color you have defined you set the graphics object to use that color before you draw.
for example
paint (Graphics g)
{
Color c = new Color(255,0,156);
g.setColor(c);
g.drawString("My new color", 10, 10);
// you can use a color defined on the fly
g.setColor(new Color(156,0,255));
g.drawString("Another new color", 10, 40);
// or a predefined color
g.setColor(Color.black);
g.drawString("A predefined color", 10, 70);
}
Steve
03-24-2004, 07:25 AM
cjard
by the way.. uhm.. applets are multifunctional things... when you say your "applet is only cyan in colour", is a bit like saying "my house is blue" .. like.. everything? the windows and doors and rooftiles and all the furniture and the food in the cupboards.. its all blue? blue writing on a blue box of blue cornflakes? etc?
then you ask how to change the colour.. you want to paint everything red? will this actually help?
*cant envisage an applet that is cyan*
03-24-2004, 05:15 PM
stefal
"then you ask how to change the colour.. you want to paint everything red? will this actually help?"
perhaps he might change the color more than once when he knows how it's done ;)