Search LinkedList and display to JtextArea

The user will type in a first name and hit the "go" button. If the name is in the list it should say the person's name is in the list in the JTextArea, if not it should say the person's name is not in the list in the JTextArea. I have the basic layout, but am lost on how to get what the user typed in the JTextField and the button click and display to textarea to all play together.
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
public class FirstName extends JFrame {
     private static final String names[] = { "Joe", "Mark", "David", "Bryan","Amber","Abigail","Skyler","Melanie" };
     private javax.swing.JButton jButton1;
     private javax.swing.JTextArea jTextArea1;
     private javax.swing.JPanel jPanel1;
     private javax.swing.JTextField jTextField1;
     private java.awt.Label label1;
     public FirstName() {
          initComponents();
          List link = new LinkedList(Arrays.asList(names));     
          setSize( 400, 200 );
          show();
     private void initComponents() {
          jPanel1 = new JPanel();
         label1 = new Label();
          jTextField1 = new javax.swing.JTextField();
          jButton1 = new javax.swing.JButton();
          jTextArea1 = new javax.swing.JTextArea();
          label1.setText("Enter a Name to Search:");
          jPanel1.add(label1);
          jTextField1.setColumns(20);
          jPanel1.add(jTextField1);
          jButton1.setText("Go");
          jButton1.addMouseListener(new MouseAdapter() {
               public void mouseClicked(MouseEvent evt) {
                    MouseClicked(evt);
          jPanel1.add(jButton1);
          jTextArea1.setColumns(30);
          jTextArea1.setRows(5);
          jPanel1.add(jTextArea1);
          getContentPane().add(jPanel1, BorderLayout.CENTER);
     private void MouseClicked(MouseEvent evt) {
     public static void main(String args[]) {
          FirstName application = new FirstName();
          application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

I'm getting a Syntax error on token "(",";"expected
for actionPerformed, what is wrong?
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
public class FirstName extends JFrame {
     private String names[] =
               "Joe",
               "Mark",
               "David",
               "Bryan",
               "Amber",
               "Abigail",
               "Skyler",
               "Melanie" };
     private JButton jButton1;
     private JTextArea jTextArea1;
     private JPanel jPanel1;
     private JTextField jTextField1;
     private Label label1;
     public FirstName() {
          initComponents();
          List link = new LinkedList(Arrays.asList(names));
          setSize(400, 200);
          show();
     private void initComponents() {
          jPanel1 = new JPanel();
          label1 = new Label();
          jTextField1 = new javax.swing.JTextField();
          jButton1 = new javax.swing.JButton();
          jTextArea1 = new javax.swing.JTextArea();
          label1.setText("Enter a Name to Search:");
          jPanel1.add(label1);
          jTextField1.setColumns(20);
          jPanel1.add(jTextField1);
          JButton1 = new JButton1("  OK  ");
          jbutton1.addActionListener(new ActionListener(this));
          public void actionPerformed(ActionEvent e) {
               String entered = jTextField1.getText();
               // search for "entered" within the list    
               if (found) {
                    jTextArea1.setText("found");
               } else {
                    jTextArea1.setText("not found");
               jPanel1.add(jButton1);
               jTextArea1.setColumns(30);
               jTextArea1.setRows(5);
               jPanel1.add(jTextArea1);
               getContentPane().add(jPanel1, BorderLayout.CENTER);
     public static void main(String args[]) {
          FirstName application = new FirstName();
          application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

Similar Messages

  • How to go about building a app that searches for and displays pages from Google.

    I was wondering how i would go about building an app that takes a users input such as a sentence (not a URL) and then searches  for their input on Google. This app would then have to display a selected page automatically on the UIWebView.
    My existing code in my viewcontroller.m is as follows:
    - (void)viewDidLoad
    [super viewDidLoad]; [webView loadRequest: [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
    I now want my app to use a users input (a word or a sentence) and search Google with that input but do it in the background then display the first search result in the UIWebView, what code would i need?
    Thanks

    Sorry, I cant view the App Store Review Guidelines
    https://developer.apple.com/appstore/resources/approval/guidelines.htmllink, maybe its because i dont have a developers account yet i will be getting one when i am ready to launch my app on the app store.

  • SSXA - search field and display results

    I have a site written in SSXA and I would like to
    a) add a search field to the pages' templates (having the functionality of Quick Search in UCM for site files)
    b) display the result page when a search is performed
    Thanks in advance!

    Have a look here http://labs.adobe.com/technologies/spry/samples/data_region/MultipleFiltersSample.html
    Gramps

  • How to make a 3 fields search box and display results below it

    Hello there I am trying to make a module for joomla cms that facilates visitor to find a particular list of packages for the search he makes by selecting the choices in three radio buttons
    , the result must be shown the search form in attractive way
    I am familier with some PHP, MySQL, CSS and little Java script
    now what do you think where should i begin to start

    Have a look here http://labs.adobe.com/technologies/spry/samples/data_region/MultipleFiltersSample.html
    Gramps

  • Search for and edit single record in database

    I am creating a few forms that access an Access database that will be used to enter data into the database.  I am able to open records from the database and scroll through records one at a time and have added features to be able to search for and display a single record.  The problem that I am having  is when I load a single record and then edit that record, I am unable to save any changes made to the record, in other words, the record doesn't update on the database.
    I can add new records and edit records as long as I scroll to them using .next(), .last(), .first(), and .previous() commands; however, when I load a single record I can't figure out how to save changes to that record in the database.

    Ok...so I think i can get it to work by doing something like:
    xfa.sourceSet.DataConnection.open();
    xfa.sourceSet.DataConnection.first();
    var oRecordList = ???????????
    var nCount = oRecordList.length;
    for (var i = 0; i < nCount; i++){
        if (CurrentRecord.rawValue != SearchField.rawValue){
            xfa.sourceSet.DataConnection.next();
    where CurrentRecord is a text field that shows the index of the current record and SearchField is the field where a user enters the record that they are searching for.
    I think I just need to figure out how to count the number of records in the database.  Any ideas?

  • Wiki search: possible to search uploads and/or comments?

    I'm trying to find out if there's a way to enable the wiki search to include the contents of uploaded files (like pdfs, docs, or xls) or the comments posted to various web pages. I could have sworn that I read this is possible, but I don't see any means of "triggering" this. Any help would be greatly appreciated!

    How are you using this portlet? Are you
    (a) allowing users to enter criteria to do a search and
    wanting the results page to group the results or
    (b) are you using it for automatically displaying content
    via auto query portlets?
    Depending on your version of portal it maybe possible to get functionality similar to what you want with multiple custom search portlets on a page. Beware, in some versions of portal there are some issues when you put multiple search portlets on a page, as they dont work independently. Therefore its not guarenteed that the following suggestions will work, but its possibly worth a try.
    (a)
    - Create a results page and add 4 custom search portlets
    - Customize each portlet
    - Set the Portlet Title to be the grouping title
    i.e Categories
    - Set the portlet so it only searches for a single results
    type,
    i.e. chose category for Content typee
    - For the results page option, choose 'Custom Page' and
    select the same page (this ensures a search from this
    portlet goes back to the same page).
    - Now set your portlet you are using to run the search
    to display results on the results page you have just
    created
    - When you perform a search, the user is taken to your
    results page and each portlet should take the search
    criteria and display the results of each type
    - The next and previous buttons may not work independently
    between the portlets depending on your versions, if this
    is the case i would suggest turning the summary off in
    the portlets
    (b)
    - similar to a, but set all the 4 portlets to be auto
    query and enter the criteria. Ensure the submission
    form is not rendered below the results.
    Hope that helps

  • Populate and display internal table results using search help exit...

    I have copied F4IF_SHLP_EXIT_EXAMPLE and made changes. I want this search help exit to populate and display contents related to 'FIELD1' when the user enters a specific value for it in the search help screen, meaning when the user restricts the search by that value.  For field2, field3, field4, field5, field6, field7, and field8 I am using a custom view.
    Following is the code:
    TYPES:  BEGIN OF t_search,
                   field2 TYPE field2,
                   field3 TYPE field3,
                   field4 TYPE field4,
                   field5 TYPE field5,
                   field6 TYPE field6,
                   field7 TYPE field7,
                   field8 TYPE field8,
                   field1 TYPE field1,
                END OF t_search.
      DATA: it_itab TYPE TABLE OF t_search,
            wa TYPE t_search,
         wa_selopt TYPE ddshselopt,
            wa_fielddescr TYPE dfies.
    ranges: r_field1 for std_table1-field1
    STEP SELECT    (Select values)
        FREE: r_field1.
    **Get the value entered for FIELD1 in search help
        LOOP AT shlp-selopt INTO wa_selopt.
          CASE wa_selopt-shlpfield.
            WHEN 'FIELD1'.
              r_field1-sign = wa_selopt-sign.
              r_field1-option = wa_selopt-option.
              r_field1-low = wa_selopt-low.
              r_field1-high = wa_selopt-high.
              APPEND r_field1.
              CLEAR: r_field1.
          ENDCASE.
        ENDLOOP.
    **Select 'ID' and 'FIELD1' from table into lt_itab
        SELECT id field1
              INTO TABLE lt_itab
                FROM std_table1
                  WHERE field1 IN r_field1.
        IF sy-subrc = 0.
    **Now, based on the particular IDs from lt_itab, I need to select other values
    from other tables which also have 'ID' as the key.
           SELECT std_table2~field2
                std_table2~field3
                std_table3~field4
                std_table3~field5
                std_table3~field6
                std_table4~field7
                std_table4~field8
                std_table1~field1
              INTO CORRESPONDING FIELDS OF TABLE it_itab
              FROM std_table2
                         INNER JOIN std_table3 ON
                                std_table3mandt = std_table2mandt AND
                                std_table3id = std_table2id
                         INNER JOIN std_table4 ON
                                std_table4mandt = std_table2mandt AND
                                std_table4id = std_table2id
                         INNER JOIN std_table1 ON
                                std_table1mandt = std_table2mandt AND                                           std_table1id = std_table2id
              WHERE
                    std_table1~field1 IN r_field1.
    'id' is common in all the std_tables --> std_table1, std_table2, std_table3, std_table4.
    STEP DISP     (Display values)
    **Then I need to gather all the results in my internal table it_itab and display
    in search help results for the value of FIELD1 entered by the user in the search help.
        CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'
          EXPORTING
            parameter   = 'FIELD1'
            fieldname   = 'FIELD1'                          
          TABLES
            shlp_tab    = shlp_tab                                   
            record_tab  = record_tab
            source_tab  = it_itab
          CHANGING
            shlp        = shlp
            callcontrol = callcontrol.
    I am not getting all the data in my internal table and wanted to know if there is anyting wrong in my select statement.
    Any guidance will be appreciated and awarded appropriate points.
    Thanks.

    the webdynpro fieldname and the search help input parameter name were made same.

  • Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotfo

    Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotform.com, but this form doesn't search the site, instead it sends me an e-mail. Do you have a solution for me? Thanks.

    Hi I want to create a search form with drop down search criteria. This form should then search on the same site and display the search results. Is there HTML available for this? Or an oline site that I can use to build this form? I created a form in Jotform.com, but this form doesn't search the site, instead it sends me an e-mail. Do you have a solution for me? Thanks.

  • Synced bookmarks can be searched for and found but many are not displayed on the complete scrollable bookmarks list.

    How odd. I've a somewhat complex bookmarks menu hierarchy, perhaps two dozen folders each containing between five and fifty bookmarks as well as a sub-folder or two. All of this is synced and displayed correctly with the bookmarks tab in the app, except for some of the more recent bookmarks that not organized into folders, and are floating inside the bookmarks menu. Of thirty or so, only five appear. Yet, when I search for them within the app they are found, including several bookmarks made today. These are bookmarks contained in the bookmarks menu but not in any particular folders. Clearly they are synced, yet the entire contents of the bookmarks menu are not displayed correctly in the app. Syncing otherwise seems swift. I've less than 600 bookmarks in total. I seek not to search for specific bookmarks but to browse my entire collection, so you can sense my frustration. I'd call this a bug. Any thoughts? Thanks!

    No I didn't change anything deep beneath the hood. My problem didn't apply to the URL, but to the name of the link or bookmark header or whatever you would like to call it. (When hitting Ctrl + D there is a Name field). I only got ???????? instead of chinese characters in the name. Also for e.g. www.cntv.cn ...but maybe all China is not in the whitelist either. ;-) But anyway, this was not the real problem for me.
    Apparently I was wrong as after a reboot of the computer it worked. The solution seemed to be to add Chinese to the language list. I don't know why it was not enough to restart Firefox?
    Now I only have problems to show chinese characters in the name field of my external link manager... But I guess it is not an issue for Mozilla.

  • How To Expand And Display Recurring Events In Content Search Web Part?

    I have a requirement to display all upcoming events. So I used content search webpart to display all the events, however the only problem is that I'm unable to expand recurring events all together. Is there a way to do this?
    Vamsi Munagala

    Hi Vamsi,
    Per my knowledge, where is no OOB method to achieve your requirement.
    As a workaround, we can customize a web part to achieve it, querying Recurring Events using CAML Query and display the results in a SPGridView.
    https://jtheblog.wordpress.com/2011/08/10/sharepoint-caml-for-calendar-recurring-events/
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to create links and display information dynamically depending on search

    hi everybody
    I have a search textbox in which the user has to give the search string like date of birth. For the search string , records will be retrieved from the database. The number of recordds will vary. Only the names of the corresponding person has to be displayed. Each one will have a hyperlink and on clicking the hyperlink the other information like name,address should be displayed.
    I have displayed the names in JSP. How to create a link for each name and display the other details corresponding to same person? The number of records retrieved will vary depending on the date of birth. Thanks in advance.

    Hi,
    what i had done in my project was, getting the collection of results for the search query i.e By giving the date of birth, you will get the matching names as collection and iterate this collection like
    <%
    Collection nameCollection = (Collection) request.getParameter("NameCollection");
    Iterator ite = nameCollection.iterator();
    String name = "";
    for (int i = nameCollection.size(); i > 0; i--)
    name = iterator.next();
    %>
    <A HREF = "http://MyWebSite/destination.jsp?name = <%name%> "><%name%> </a>
    <%}%>
    For the above code, in Href i am using name in two places. one is for display. i hope you dont have any problem in this
    Another one for getting the information about the particular name. use request.getParamter method in the destination Jsp and do one more DB call by using the input parameter.
    Note: This is working only unique Name. otherwise use HashMap for getting the userId and Name. By passing the userId in the backend we can get the information.
    I hope this will helpful to get out of the issue
    Regards
    Balakrishnan.R

  • Search Analytics and Banner display requirements in Endeca

    Hi,
    How to achieve the following requirements in Endeca,
    a)     The client is looking to see search analytics data such as popular keywords searched, Top search misses etc. Which Endeca module license should the client buy for achieving the analytics functionalities?
    b)     One of the client requirements is to configure mapping between search keywords and banners. When the user searches for a configured keyword, the result page would display the banner along with products. How to achieve this in Endeca?

    As I understand it. You have created a pagegroup
    1. In the root page of the page group, in the banner region you have added a custom search portlet
    2. In the page group you have created a page and added a custom search portlet to it.
    3. You have edited defaults of the custom search portlet in the banner region of the root page so that it shows the results in the page created in step2
    4. When you submit a search in this custom search portlet you are seeing an error.
    If this is not the exact scenario, please can you explain clearly what the problem is

  • Hide and Display submit button on the Simple search page.

    Heading 1: h1 Hide and Display submit button on the Simple search page.
    I'm trying to set the enabled property of the submit button on the simple search page. The business case is to disable the button if the VO has not returned any rows.
    The Submit button is on the page button bar.
    regards
    Abhi

    Hi,
    I have already added this in my ProcessRequest, the issue I am facing is it the submit button is disabled while I load >the page which is fine. but when I do a search and the query returns rows still the submit button is disabled.---Will nt reuired SPEL here..
    ---On go button click setsession value.
    Follow below steps:
    CO PR:*
    OASubmitButtonBean continueBtn=(OASubmitButtonBean)flowLayout.findChildRecursive("continueBtn");
    if(continueBtn != null && "D".equals(oapagecontext.getSessionValue("Flag"))
    continueBtn.setDisabled(false);
    else if(continueBtn != null )
    continueBtn.setDisabled(true);
    CO PFR:_
    if(pageContext.getParameter("Go") != null)
    oapagecontext.putSessionValue("Flag","D");
    Regards
    Meher Irk
    Edited by: Meher Irk on Mar 22, 2011 7:48 PM
    Edited by: Meher Irk on Mar 22, 2011 7:48 PM

  • Search and display database records

    hello, kindly help me as to how to create a search page with multiple search parameters and how to display the result (within same page or on a different page). i am a dummy and i am using dot php/// pls very urgent. thanks

    easycfm.com has entry level tutorials.
    This book, http://forta.com/books/032166034X/, will help you get started.
    For your specific questions, you can have a simple html form for your search page. 
    Whether you process the form on the same page or a different one doesn't really matter, but on that page, the form fields you submitted will now be cf variables in the form scope.  You use the cfquery tag to send your sql to the db, and the cfoutput tag to display the results.
    google and coldfusion play well together.  If you search on cfquery, the adobe documentation will usually be the first offering.

  • Search result to get data from bing search and display it in sharepoint page.

    I have configured result source which gets data from bing site,i have given following url as source url
    http://www.bing.com/search?q={?searchterms}&format=rss&Market=en-Us
    but it returns only 8 results from RSS. i want to get all results of search and display it in my SharePoint search results page. 
    any pointers will be helpful. 

    Hi,
    According to your post, my understanding is that you wanted to search result to get data from bing search and displayed it in sharepoint page.
    To display more items, you can modify the item number when you add
    New Query Rule.
    To get all results, I recommend to use the “Show More”
    link in the result page.
    You can enter the URL when you add New Query Rule:
    "More" link goes to the following URL: http://www.bing.com/search?q={searchterms}
    Here is a great blog for your reference:
    http://sharepoint-community.net/profiles/blogs/integrate-bing-with-sharepoint-online-2013-search
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

Maybe you are looking for