Results 1 to 9 of 9
Thread: JTextField input to change color
- 10-19-2012, 11:17 AM #1
Member
- Join Date
- Mar 2012
- Posts
- 13
- Rep Power
- 0
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.
- 10-19-2012, 01:37 PM #2
Re: JTextField input to change color
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-19-2012, 03:45 PM #3
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-19-2012, 03:56 PM #4
Member
- Join Date
- Mar 2012
- Posts
- 13
- Rep Power
- 0
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.
- 10-19-2012, 04:23 PM #6
Member
- Join Date
- Mar 2012
- Posts
- 13
- Rep Power
- 0
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
- 10-19-2012, 09:02 PM #7
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-19-2012, 09:07 PM #8
Member
- Join Date
- Mar 2012
- Posts
- 13
- Rep Power
- 0
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
Similar Threads
-
How to change background color
By Jeffrey4u in forum Sun Java Wireless ToolkitReplies: 0Last Post: 10-22-2011, 08:32 AM -
Change the color in my program
By carl in forum New To JavaReplies: 5Last Post: 04-03-2009, 12:20 PM -
Color Change of data
By Java.child in forum AWT / SwingReplies: 20Last Post: 02-12-2009, 06:51 AM -
How to Change the color of MultiColumnListBox
By Java.child in forum AWT / SwingReplies: 1Last Post: 01-22-2009, 12:07 AM -
How to change string Color
By Java.child in forum AWT / SwingReplies: 3Last Post: 01-06-2009, 04:27 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks