Results 1 to 3 of 3
  1. #1
    soc86 is offline Member
    Join Date
    Oct 2008
    Rep Power

    Default Adding color to a java applet?

    I'am trying to add color to the following, i'am unable to do this.
    This is the first java applet i have written, any advise or amendments?

    public class greetingApp extends JApplet {

    public static void main(String args[]) {

    System.out.println("Hi Peter";
    System.out.println("from Stuart to Peter");
    System.out.println("at University of Glamorgan");
    System.out.println("Pontypridd CF37 1DL");


  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    That's not applet code as applets in general don't have a main method. Please do yourself a big favor and read the Applet tutorial on the Sun site to see how to do this right.

    Lesson: Applets (The Java™ Tutorials > Deployment)

    After going through the tutorials, give it a try again, and then please feel free to come on back if you have any further questions.

    Good luck.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    To change to color of displayed text you need to be using a component that supports changing the color. Most simple components only have one color that they use. See the Component class for various methods to set colors.
    More complicated classes allow you to have different colors for different pieces of text.
    You'll find these as you progress in learning java. For now, with
    System.out.println(... you get only blank.

Similar Threads

  1. Replies: 4
    Last Post: 10-25-2010, 05:59 AM
  2. Replies: 4
    Last Post: 09-13-2008, 11:07 AM
  3. Replies: 3
    Last Post: 07-23-2008, 08:07 AM
  4. adding the Java Console to a ContentPane
    By naipulb in forum New To Java
    Replies: 1
    Last Post: 06-10-2008, 08:51 AM
  5. Adding listener to non-Java object?
    By cruxblack in forum Advanced Java
    Replies: 5
    Last Post: 07-30-2007, 02:19 AM

Posting Permissions

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