This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Gui help

 
Liam h
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,

I am new to java and would like to get some help, i have a gui and i would like to get some advice for making the gui do what i want it to do!!

The problem is that i don't know how to approach it, i want to place a string of keywords in the program and when the user enters a string into the gui. I want to compare the string entered with the words in the keyword string
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would probably be easier to help you with this by doing little pieces at a time.

First identify the question, there are a few I can guess at from your post.
How do I get data from a Component?
How do I perform actions based on user interaction?
How do I layout a simple GUI?

These are just the ones related to the GUI that I see. Pick one of these (or something else if I missed your real question) and we can go from there.
 
Liam h
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Steve,

Thanks for your time...

In the GUI, I have a jButton and a textField this how I'll get the data from the component.

I think What I am trying to do is in the actionListener is have the code to compare the input string with a string of keywords.

This is where I have the problem, which way should I go about it or what methods ot use.
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean you have a String that you got from the user, and you have an Array of Strings to compare it to?

That depends on what kind of comparison you want to make. At a guess you're not looking for a simple equals().

Are you looking for:
userString is contained in one of the systemStrings?
userString is close to one of the systemStrings?

Also this question doesn't seem to be realated to the GUI, but the String processing so it probably should have been in the 'Java in General' forum. Not really a big deal, but one of the moderators might move it.
 
Liam h
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I realise that this not related to GUI, I could not find the right forum, sorry should have looked harder.

Yeah I have a string that i get from the user and compare it to an array of strings.

I am looking for userString is contained in one of the system strings
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Liam h
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you very much,

I will give this a try...

and again thanks for your help
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. If you plan to continue posting here at the ranch you will be asked to change your user name to appear as a first and last name that is at least real sounding. It is part of the naming policy.

Glad I could help.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
soup,

Welcome to Javaranch!! We don't have too many rules around here but we do have a Naming Policy. Please adjust your display name accordingly.

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic