Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Mar 2009
    Location
    Texas
    Posts
    31
    Thanks
    1
    Thanked 2 Times in 2 Posts

    command text color

    im making a little program and im wanting the color of text to change when an error occurs so something like

    what is your name? mom
    ERROR: name must be atleast 3 characters

    so when the error happens it turns either that specific text red or all text red i don't care just changing the color of the text is what i want

  • #2
    Regular Coder cs_student's Avatar
    Join Date
    Oct 2009
    Location
    ~/
    Posts
    195
    Thanks
    2
    Thanked 22 Times in 22 Posts
    I don't believe this is possible when printing text to the command line interface. (unless your using some special third party library)
    what is your name? mom
    ERROR: name must be atleast 3 characters
    Isn't mom 3 characters long. I think you want to print:
    "ERROR: Name must be greater than three characters in length"

    cs_student

  • #3
    New Coder
    Join Date
    Mar 2009
    Location
    Texas
    Posts
    31
    Thanks
    1
    Thanked 2 Times in 2 Posts
    oh wow yea it should have been greater than 3 characters and i found a way to do it by running cmd commands to do color 4 or whatever but i think me searching how to run a cmd command in java put an alert up on our schools security and today the network administrator disable my cmd so now i cannot test my java code

  • #4
    Regular Coder cs_student's Avatar
    Join Date
    Oct 2009
    Location
    ~/
    Posts
    195
    Thanks
    2
    Thanked 22 Times in 22 Posts
    In my ap computer science class last year I would just boot up linux via a flash drive so that I could do whatever I wanted. There are quite a few functional gui linux distros which will fit on a small flash drive.

  • #5
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    You can probably also write your commands to compile and run your program in a windows batch file, and pipe the output to a text file.

  • #6
    New Coder
    Join Date
    Mar 2009
    Location
    Texas
    Posts
    31
    Thanks
    1
    Thanked 2 Times in 2 Posts
    yea i tried to execute the class through a bat file but didnt get it to work then the bell rang, and now for some reason i have like no rights now so i like cannot do anything, i would open up linux but there servers detect any of those things, if the name of the computer isn't in there system you cannot join the network or do anything, and I would get in big trouble


  •  

    Tags for this Thread

    Posting Permissions

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