DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004

    what is a class file??

    many thanks on replies to previous posts guys,

    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.


  2. #2
    Join Date
    Feb 2004
    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.

  3. #3
    Join Date
    Mar 2004
    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)

  4. #4
    Join Date
    Mar 2004
    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?

  5. #5
    Join Date
    Mar 2004
    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.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.drawString("A predefined color", 10, 70);



  6. #6
    Join Date
    Feb 2004
    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*
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  7. #7
    Join Date
    Mar 2004
    "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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.