Results 1 to 2 of 2
Thread: Getting info from a GUI
- 10-16-2010, 09:08 AM #1Member
- Join Date
- Jul 2010
- Rep Power
Getting info from a GUI
I'm pretty new to Java programming, and I've got a problem I just can't seen to solve, or get past.
I'm trying to write a chat program that is made from 3 classes; a GUI class, a send class and a receive class. This is how my instructor wants it done. The program is to use threads. I have had very minimal experience with threads.
I'm writing the send class at the moment. What I want to do is take the text the user enters into a jTextArea in the GUI and send it from the send class to another socket.
The problem I'm having is writing a condition that checks to see if the user has entered text into the JTextArea. If there is text, the send class takes that text and sends it over the socket. I'm thinking I need some kind of loop structure that checks to see if there is text to send. Once there is text to send the loop is stopped, and the text is sent.
In my GUI, once text is entered it is copied to a string, and the JTextArea is then set to blank. I have a method called getText() that returns that string. Everytime I write a loop in my send class that uses getText() as part of a condition, I end up in an infinite loop type situation, regardless of any text entered.
I would appreciate any and all help. I don't expect anyone to write code for me; I want to do it myself. But could you please explain where I am going wrong, and which particular topics I should study up on.
Thanks everyone in anticipation of your help.
- 10-16-2010, 01:03 PM #2The problem I'm having is writing a condition that checks to see if the user has entered text into the JTextArea.
I'm thinking I need some kind of loop structure that checks to see if there is text to send.
And it's a strange chat program that starts sending as a user starts typing. With my typing skills, I would consider it unusable.
- By ajeeb in forum New To JavaReplies: 1Last Post: 02-06-2009, 01:04 PM
- By ravi in forum New To JavaReplies: 2Last Post: 11-03-2008, 02:30 PM
- By Ragster in forum JDBCReplies: 2Last Post: 01-17-2008, 05:19 PM
- By venkatashiva in forum Java SoftwareReplies: 3Last Post: 01-01-2008, 05:25 AM
- By kishi in forum Advanced JavaReplies: 0Last Post: 11-16-2007, 01:44 PM