JTextField input to change color
Hello all, I'm having some issues with something and I hope someone can help me. I'm making this little applet that has 3 JTextfields and undernearth a String s = "Hello";
The user can type into each JTextField values, and depending on these values the string "Hello" will change color. So if they typed in 255 0 0 and pressed the button it would change the color of the world "Hello to red. Likewise if they typed in 255 60 180 it would change the whatever color this represents. The thing is I have no idea how to tell the program that once the button is clicked, turn the color of the "Hello" string into the corresponding RGB values.
I've set a global variable which sets the default color to black. I also have the actionPerformed and ActionKeyListener. I'm sure the code I need has to go into the actionPerformed method but if anyone can help that would be amazing. Unfortunately I can not provide my code here on the site but if you think you understand what I mean then I'll be able to use any help you provide me more than likely.
Thanks.
Re: JTextField input to change color
Quote:
Originally Posted by
Java Junior
Unfortunately I can not provide my code here on the site
Unfortunately that means you're not very likely to get any targeted help. We're not mind readers here, so we don't know where you're stuck.
Have you gone through the Swing tutorials linked from the API of relevant Swing classes?
Oh, and Java doesn't have global variables, so it's anybody's guess what you're on about.
db
Re: JTextField input to change color
There's no need for private messages. If you can't discuss your assignment adequately on the forum, you can't expect much help.
Oh, and I don't click external links. Not in a forum post, not in a PM. Code posted here, on the other hand, I do read. As would the many who will read this thread year after year, and not have to be disappointed at a pastebin link that has long gone dead.
db
Re: JTextField input to change color
I can not post my code here as when I submit my work the university scan the internet with a program called turnitin and it will show as a match on this site. Then they will think that I copied my code from this site even though this is my code... Thanks anyway but I'll wait to see if anyone else can help.
Re: JTextField input to change color
My experience here is that you're probably not going to get much specific help if we can't see what you've tried and how it isn't working. Sorry.
Re: JTextField input to change color
I can use a pastebin link because I can set it to private, but having the code openly pasted on the forum is scanable and I risk being dropped from my course if they think I copied from the forums. But here is the pastebin link.
Private Paste ID: gWb5iPap
Re: JTextField input to change color
Don't keep your hopes up. Most members, self included, won't click external links, and corporate firewall settings block file sharing sites for many others.
Moreover, it is against the spirit of a forum for the problem to not be posted here.
Your call.
db
Re: JTextField input to change color
Well a simple paste bin link is not going to make your firewall go nuts mate. I understand that it's nice for everyone to benefit from the help you provide me which you still can, anyone who wishes to view the code can very easily with just 1 click of the link. It's infact better because not only does it provide syntax highlighting but you can also view the entire program in 1 page without having to scroll through a 2 inch code window. If you really won't help me for the sake of a link then thanks anyway but I'll wait around for someone who doesn't mind clicking a link.
Re: JTextField input to change color
Quote:
Originally Posted by
Java Junior
Well a simple paste bin link is not going to make your firewall go nuts mate.
Please don't speak out of ignorance, because yes in fact my work firewall and many others does in fact prevent this.