I am doing on a program to let user enter a Alphabet then the program will search the sentance in put by the user and highlight the Alphabet and display the Alphabet in a different color from the string.
this is the problem i know how to extract the Alphabet from the string but i dun know how to print the string out with individual Alphabet in a different color.
I am open to all suggestion and advice thanks in advance!!!
is this a command line application program that we are talking about..? or is it a GUI ? if its a GUI then ever heard of AWT.
im not sure if the command line program can allow individual characters to change color, but there must be some way i guess so, mean while let me check if i can change colors at when ouputt is on command line prompt
You could use a JEditorPane or even a JLabel: The JEditorPane has the advantage that it is editable. [ February 02, 2006: Message edited by: Jeff Albertson ]
There is no emoticon for what I am feeling!
Koh Khai Huat
Ranch Hand
Joined: Aug 05, 2005
Posts: 100
posted
0
Hi
thx i see yr way but it dun't seem to fit in to what i am doing sorry about that may be i never explain my self clearly. I am leting the user to select the color by using the 3 scrollbar which is Red, Green, Blue so how do u go about doing that???
regards KKH
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Where is the problem? Is it with creating a color from your user's input? Recall that in HTML you can specify color as a number, for example yellow is:
color = "#FFFF00"
Koh Khai Huat
Ranch Hand
Joined: Aug 05, 2005
Posts: 100
posted
0
hi
thx i have a problem. the ptoblem is that i will be checking for vowels agains the string which the user input. then the user will select the RGB color using 3 scroll bar and then click submit then at the bottom the program will print out the string again but this time with the vowels lettes in the color the user select. hope this explaination is a better one thx sry to trouble u so much thx in advance
regards KKH
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
I think you have described your task fairly, well. I've shown you how Java can use basic HTML markup to add colors to text. I suggest you start coding and post specific questions when you get stuck.
Koh Khai Huat
Ranch Hand
Joined: Aug 05, 2005
Posts: 100
posted
0
Hi
Thx Jeff your method works and i learn something new haha and i did't know that u can display html code in a JLabel Wow once angain thank you.
regards KKH
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Setting Defferent Color Of Alphabet In A String