Results 1 to 4 of 4
  1. #1
    gisler is offline Member
    Join Date
    Apr 2009
    Posts
    26
    Rep Power
    0

    Default 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:

    Java 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

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    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?

  3. #3
    gisler is offline Member
    Join Date
    Apr 2009
    Posts
    26
    Rep Power
    0

    Default

    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

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    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!

Similar Threads

  1. Problems here
    By Keno777 in forum New To Java
    Replies: 2
    Last Post: 11-13-2009, 11:35 AM
  2. how to getText() properly?
    By javamula in forum New To Java
    Replies: 12
    Last Post: 09-16-2009, 05:45 AM
  3. having problems
    By pinkdiamondgail in forum New To Java
    Replies: 6
    Last Post: 02-06-2009, 11:35 PM
  4. [SOLVED] new2java- gettext settext
    By obdi in forum New To Java
    Replies: 4
    Last Post: 07-21-2008, 09:28 AM
  5. problems with JPA
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 05:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •