I am trying to read text from a simple Jtextfield using the syntax
String StrRound = txtRoundName.getText();
if (StrRound.equals("")) ... etc
I am also using the method dispose() to close the window. Since when
the window is re launched the previous contents inserted in the
txtRoundName is displayed, I had to clear the fields using
txtRoundName.setText(""); in a separate method.
I found out that when enabling the setText(""), the condition if
(StrRound.equals("")) is returning that the string StrRound is empty
(actually the user keys in some data). Whilst, when I remove the
statement txtRoundName.setText("") everything works fine.
The window is instantiated through a separate class.
Could you highlight why this is occurring?
Thanks
Nothing wrong with that.
> I am also using the method dispose() to close the window. Since when
> the window is re launched the previous contents inserted in the
> txtRoundName is displayed, I had to clear the fields using
> txtRoundName.setText(""); in a separate method.
I don't think dispose() will do anything to the value entered into your
JTextField.
> I found out that when enabling the setText(""), the condition if
> (StrRound.equals("")) is returning that the string StrRound is empty
> (actually the user keys in some data). Whilst, when I remove the
> statement txtRoundName.setText("") everything works fine.
It's not really clear what you are doing.
> The window is instantiated through a separate class.
>
> Could you highlight why this is occurring?
Not without some code and preferably an SSCCE.
--
Knute Johnson
email s/nospam/knute2009/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Knute Johnson wrote:
> Nothing wrong with that.
Well, one slight deviation from the Java coding conventions - variable names
are supposed to start with a lower-case letter conventionally.
Knute Johnson wrote:
> It's not really clear what you are doing.
tamasu wrote:
>> The window is instantiated through a separate class.
>>
>> Could you highlight why this is occurring?
Knute Johnson wrote:
> Not without some code and preferably an SSCCE.
+1
--
Lew