-
gettext problems
Hi,
ok i know this should be very simple and straight forward.
I am simply trying to check the data that has been entered into a couple textfields. If i have set a default text the getText function reads it. Once i change the text when the program is running it still only gets the original text.
This is my code for the method:
Code:
private String testSettings(){
String status = null;
String serv = serverAddress.getText();
String ports = port.getSelectedText();
String name = connectionName.getSelectedText();
if (serv==null)
{
JOptionPane.showMessageDialog(connect, "Please enter in server address or 'localhost'");
status="bad";
}
if (ports==null)
{
JOptionPane.showMessageDialog(connect, "Please enter in connection name'");
status="bad";
}
if(name==null)
{
JOptionPane.showMessageDialog(connect, "Please enter in port number");
status="bad";
}
return status;
}
Many thanks
gisler
-
I'm not sure what you're asking as we really don't see how you read in text or many other pertinent parts of your code. As for the method above, shouldn't it return a boolean instead of a pseudo-boolean String? If not a boolean, then at least an enum?
-
Your right. Returning a boolean makes a lot more sense.
I figured it out. it was as foolish as the problem. thanks for your time
-
Glad you've got it solved -- please mark this thread as "Solved" using Thread Tools.
Also, I don't see any of this as being foolish problems. Any opportunity to learn something new is not foolish at all. Best of luck!