Question:
Color change command line in Java?
Timothy
2012-05-17 08:34:40 UTC
This is the line I have...
Outputarea.setTextColor(Color.red);
The setTextColor doesn't work. What is the actual line for it?
Three answers:
?
2012-05-17 08:41:45 UTC
There is not a way to do this universally in java because it's OS specific. I mean you could tell java to run a dos command to change color of the text, or use ansi color code to color stuff in Linux...



The best option is not to do it because your code will no longer be portable.
redfern
2017-02-21 06:14:16 UTC
once you're launching from an IDE, like JCreator, Netbeans, Eclipse... those are literally no longer the CommandLine invocation of a Java utility. indoors the old days we made a folder, used Notepad and typed the code such as you instruct. Then... >$ cd /myPrograms/Java /myPrograms/Java >$ javac CLCDemo.java /myPrograms/Java >$ java CLCDemo.java one-potato 2-potato 3-potato greater effective and it would output the 4 args edit:::::::::::: I extremely now copied your keystrokes, made a checklist CLDemo.java man or woman@man or woman-computing device: ~$ cd '/abode/man or woman/computing device/testCmmdl... man or woman@man or woman-computing device: ~/computing device/testCmmdline$ javac CLDemo.java man or woman@man or woman-computing device: ~/computing device/testCmmdline$ java CLDemo one 2 3 There are 3 command-line arguments. they're: arg[0]: one arg[a million]: 2 arg[2]: 3 man or woman@man or woman-computing device:~/computing device/...
godfatherofsoul
2012-05-17 09:05:44 UTC
I always have this problem. Try calling validate() on your container or repaint(). validate() has worked for default UI stuff for me and repaint() has worked for custom components.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...