Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Input and Output via JTextField

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Thanked 0 Times in 0 Posts

    Default Input and Output via JTextField

    How would I display certain output text if the text entered equaled "text".
    If that makes any sense.

    So lets say you enter a question into a JTextField.
    You press a button that submits the text.
    The output displayed depends on what the question you asked was.

    Think about it as "If question = What color is the sky? On submit, display text "Blue".

    I cant figure out how to implement this.
    I confused myself.

  2. #2
    Elite Member
    Join Date
    Jul 2013
    Thanked 264 Times in 243 Posts

    Default Re: Input and Output via JTextField

    Maybe show what you already have and then somebody could tell you where you are off.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    SW Missouri
    Thanked 2,633 Times in 2,603 Posts

    Default Re: Input and Output via JTextField

    Do the questions that are asked have to be an exact match for the Strings the program will use to find the answer?
    For example here are two different Strings that ask the same question:
    "What color is the sky?"
    "What is the sky's color?"

    How many different Strings could ask the same question?
    If you don't understand my answer, don't ignore it, ask a question.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 888 Times in 871 Posts

    Default Re: Input and Output via JTextField

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    And how will you have an appropriate answer for every question a user might ask?

Similar Threads

  1. Array Output in JTextField
    By shodai in forum AWT / Java Swing
    Replies: 3
    Last Post: April 14th, 2013, 07:20 PM
  2. How to repaint() a class in a JFrame, with a JTextfield user input
    By DANGEROUSSCION in forum Object Oriented Programming
    Replies: 1
    Last Post: March 23rd, 2013, 03:06 PM
  3. [SOLVED] History of previouse input in JTextField
    By learn_java in forum AWT / Java Swing
    Replies: 1
    Last Post: November 7th, 2012, 08:38 AM
  4. [SOLVED] JTextField for Date input ( DD/MM/YY) or (DD : MM : YY)
    By chronoz13 in forum AWT / Java Swing
    Replies: 3
    Last Post: October 10th, 2011, 04:48 AM
  5. need help Printing output from a JTextfield
    By juanbond311 in forum Java Theory & Questions
    Replies: 27
    Last Post: June 21st, 2010, 08:26 AM