Onload JComboBox should display "Search" in it

I want to display "Search" text by default in JComboBox. But it should not be added into JComboBox list, once I select something from drop down or click on JComboBox "Search" text should goes off. On loading the application I want to show to user that this is Search Box. The "Search" text should not be in the the JComboBox list.
I am pasting the sample code below.
package applet;
import java.awt.BorderLayout;
import javax.swing.JComboBox;
import javax.swing.JFrame;
public class ComboBox extends JFrame{
     public static void main(String args[])
          ComboBox frmCombo= new ComboBox();
          String[] pets = {"Alen", "Merry"};
          JComboBox cmbBox = new JComboBox(pets);
          cmbBox.setEditable(true);
          frmCombo.add(cmbBox, BorderLayout.NORTH);
          frmCombo.setSize(200, 200);
          frmCombo.setVisible(true);
}

import java.awt.*;
import java.awt.event.FocusEvent;
import javax.swing.*;
import javax.swing.plaf.basic.BasicComboBoxEditor;
public class ComboBoxSearch extends JFrame {
     public static void main( String args[] ) {
          ComboBoxSearch frmCombo = new ComboBoxSearch();
          String[] pets = { "Alen", "Merry" };
          JComboBox cmbBox = new JComboBox( pets );
          cmbBox.setEditable( true );
          cmbBox.setEditor( new IndicateSearchEditor() );
          frmCombo.setLayout( new BorderLayout() );
          frmCombo.add( new JTextField(), BorderLayout.NORTH );
          frmCombo.add( cmbBox, BorderLayout.SOUTH );
          frmCombo.pack();
          frmCombo.setVisible( true );
     static class IndicateSearchEditor extends BasicComboBoxEditor {
          private boolean once = false;
          private Object value;
          public IndicateSearchEditor() {
               super();
               editor.addFocusListener( this );
          public void focusGained( FocusEvent e ) {
               if ( !once ) {
                    once = true;
                    setItem( value );
                    value = null;
          public void setItem( Object anObject ) {
               super.setItem( anObject );
               if ( !once ) {
                    value = anObject;
                    editor.setText( "Search" );
}

Similar Messages

  • 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.

  • How to display search results in a table or in different columns

    Hi
                 How can i display search results in multiple columns or in a table so that the user can sort the results based on a particular property displayed in the search results.
    Thanks in advance
    Regards,
    Vidya

    Hello,
    To display search results in a table, in different columns or more... you should modify SearchResultLayoutSet.
    Create your own StandardSearchResultRenderer (exp My_StandardSearchResultRenderer) and add to SearchResultLayoutSet. Than change whatever you like to achive your aim.
    Thank you.
    Hope this helps.

  • Altavista will not display search results

    altavista us will not display search results. altavista canada works fine. On us site results will display in no style page but not in basic page style. The page comes up blank. This may have been caused by delta search. I think I have rid my computer of delta? Reloaded firefox. I use norton 360 and have run registry clean up and virus scans. Also cleaned explorer. In explorer the u.s. altavista works ok that is why I think it something to do with firefox and delta search showed up at the same time unwanted and forced a change on my home page. Have cleared computer of what delta files I could find my have something in the registry but I would not know what to look for or to do with. I am running xp

    In a round about way you solved my problem cor-el ! At the end of standard diagnostic there was mention of malware so I ran malwarebytes before running profile manager. malwarebytes found 21 items some in the registry. deleted these items and tried altavista us again and to my surprise it is working ok now.I thought norton 360 would catch such things but I guess it doesn't ! will keep and run a malware program from now on. thank you for your help.

  • Adding value of one field into another field and should  display it

    Hai Experts,
    i have problem try help me plz,
    my problem is:
    i have some fields like A,B,C,D,E.in my ddic table and i designed a screen with same fields
    so here i want have values on gallons
    ex : think
    E = order value
    C = gallons
    and when i enter each value in order value it should go sum with gallons and should display on screen ,it should not save in table,when i open screen next time it should not show any values

    Hi  ,
    U Can try the   UserEXIT  PBAS0001 component  EXIT_SAPFP50M_001 . The code in the Include Program  ZXPADU01  looks  something  like  this .
    DATA: I0002 TYPE P0002.
      CLASS CL_HR_PNNNN_TYPE_CAST DEFINITION LOAD.
      CASE INNNN-INFTY.
        WHEN '0002'.
          CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN
            EXPORTING
              PRELP = INNNN
            IMPORTING
              PNNNN = I0002.
          MOVE I0002-VORNA  TO I0002-RUFNM.
          CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PNNNN_TO_PRELP
            EXPORTING
              PNNNN = I0002
            IMPORTING
              PRELP = INNNN.
      ENDCASE.
    U can also  implement  the  same in the BADI  HRPAD00INFTY   method  BEFORE_OUTPUT . The  same   code  should  work

  • Create an Object(Store) based on Store Id,it should display Store Name

    Hi,
    My Question is, Create an Object(Store) based on Store Id,it should display Store name at report level.
    I did the list of values Name changed from Store Id to Store Name in Object Properties in Universe level. These values are changed in the universe level, but not displaying in Report level. How it is possible? can any one give the reply.
    Thanks & Regards
    Madhu...

    What i understand is you wan the user to be prompted with STORE_ID values and when they select a store_id or multiple store _id then you want to display the store names for these store _id selected in the report . If this is correct then follow below
    In Universe create a object whose definition is store_name and not store id. In the LOV of this object click edit and then in the LOV add STOREID, STORE_NAME COLUMN with STORE_ID so now the user will see the store-id and the store name for that store_id but when you select any values it will show only the store name.

  • Storage bin should display in MB52

    Hi All,
        Storage bin should display in MB52  T-code warehouse stock dispaly, Please guide me how it possible...
    Regards
    Hari

    Hi Hari,
    MB52 Tcode is only for display stock in Inventory Management Level/ storage location level. If you want display stock in storage bin level, you can use t-code :
    1. LX03   - Bin Status report
    2. LS26   - Total Stock per Material (Warehouse Management)
    3. LS24   - Bin Stock per Material
    I hope it can explain your problem.
    Pls rewards point if helpfull.
    Thanks
    Gunawan

  • In Requestor POWL, Shopping cart Related/Follow on documents should display as columns in POWL Table

    Hello Experts,
    Currently we are in SRM 7.02 implementation, for this we got requirement like below.
    In Requestor POWL, Shopping cart related/follow on documents should display as columns in POWL. Please suggest me on this, how can i achieve this requirement. Thanks in advance.
    1. we have Related/Follow on documents as shown in below screenshot.
    2. As shown in above screenshot, these related/follow-on documents should show as columns in requestor POWL, as shown in below screenshot.
    Thanks & Regards
    Sivaram.

    Hi Siva,
    Take a look at the last part of the following document.
    http://scn.sap.com/docs/DOC-25692
    Regards,
    Lisandro

  • Audit trial in bpel console should display err msg only without data

    Hi,
    I have requirement where audit trail in BPEL Console should display meaningful error message without displaying payload. Please provide some workaround for the same.
    Thanks in advance.
    Edited by: 786384 on Aug 12, 2010 2:09 AM

    Hi,
    I have requirement where audit trail in BPEL Console should display meaningful error message without displaying payload. Please provide some workaround for the same.
    Thanks in advance.
    Edited by: 786384 on Aug 12, 2010 2:09 AM

  • How to display search results in content area

    Hi
                 How can I display search results in the content area as seen in sdn.
    Thanks in advance.

    Hi,
    http://help.sap.com/saphelp_nw70/helpdata/en/cc/f4e77ddef1244380b06fee5f8b892a/frameset.htm you find the relevant guidelines.
    You can filter the PCD object setting the Search Layout Set of your Searc Iview.
    In System Admin > System Configuration > Content Management > User Interface > Settings > Layout Set and duplicate the "SearchResultLayoutSet" layout set.
    Then you have to duplicate its Collection Renderer "StandardSearchResultRenderer".
    In its property "Resource Types to be Filtered" set as value "-http://sap.com/xmlns/pcd/app/iview".
    Then assign the new Collection Renderer to the new Layout Set and that's it!
    Now if yuor Search Iview uses this new Layout Set, when you search a PCD object the iviews will not be shown!
    (or)
    In the entry "Predefined Properties" of the search options set, you will need to enter "resourcetype(value=http://sap.com/xmlns/pcd/app/page/default)" if you want the search to be limited to resources defined as pages. Leave out /default if you dont want the end user to be able to change the filter.
    If you want the parameter reflected in the URL, you can find information about how to do it here: /message/280371#280371 [original link is broken]
    Check and try either ways.
    Regards,
    Ponneswari A.

  • I iPad 3 fails to recognize cellular data In a number of locations Displays "searching and No Service" I have narrowed this to device problem. What can I do?

    i iPad 3 fails to recognize cellular data In a number of locations Displays "searching and No Service" I have narrowed this to device problem. What can I do?

    Hello there, OSOSANYA.
    The following Knowledge Base article provides a great checklist of steps and additional recommendations for troubleshooting issues with cellular connection:
    iPhone: Troubleshooting a cellular data connection
    http://support.apple.com/kb/ts3780
    Follow these steps for help troubleshooting cellular data issues on your iPhone. After performing each step, please test to see if the issue is resolved.
    Toggle airplane mode: Tap Settings, turn airplane mode on, wait three seconds, and then turn off again.
    Restart your iPhone.
    Make sure that your software is up to date:
    Check for a Carrier Settings Update: Tap Settings > General > About.
    Check for an iOS Software Update: Tap Settings > General > Software Update.
    Note: Some updates may require a Wi-Fi connection.
    Remove the SIM Card and reinsert it. Allow the iPhone to acquire the network again.
    If your SIM card has SIM PIN enabled, try turning it off: Tap Settings > Phone > SIM PIN.
    Try another location. If a different location works, but the original location still doesn't, contact your carrier to report the issue.
    Reset network settings: Tap Settings > General > Reset > Reset Network Settings.
    Restore the iPhone as new.
    Contact your carrier to:
    Verify that the iPhone is properly set up on the account with the appropriate, current data plan.
    Verify that there are no account-related blocks.
    Find out if there are specific error messages in the carrier logs that could help determine why the issue is occurring.
    If none of the above steps resolves the issue, contact your carrier, make an appointment at an Apple Retail Store, or contact AppleCare to troubleshoot further.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Data View properties doesn't contain a Miscellaneous - Display Search Box option

    When I create a List View via the web  and edit the web part I have a Miscellaneous - Display Search Box option.
    When I insert a Data View via SharePoint Designer 2013 I don't see that option.  Is there a work around?
    Thanks,
    Dwight

    Hi,
    I can reproduce the issue and there are seems no OOTB way to display the search box at this moment.
    A workaround is using JavaScript and query string to filter a list view and retrieve the values you want.
    http://audministrator.wordpress.com/2013/12/08/sharepoint-2010-filter-a-list-using-an-input-box/
    http://techtrainingnotes.blogspot.com/2012/03/sharepoint-search-filter-or-sort-lists.html
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they
    help and unmark them if they provide no help. If you have feedback for TechNet
    Subscriber Support, contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Should display both Spanish and English lang. at a time in BEx analyzer

    Hi All,
    I need to display both Spanish and English lang. in Bex analyzer.
    InfoObject is language dependent.
    Ex: For material it should display description in Spanish and English at a time.
    Am only able to display one at a time.
    Please suggest.
    Regards,
    Sandeep.

    Hi Sandeep,
    As Kodandapani mentioned it’s not possible to display both languages same
    time as its mapping to same T table where LANGU is part of key.
    I recommend you to create an attribute or maintain another table for other
    language to display at a time.
    if anybody get any better ideas then pl share.
    Regards,
    Naveen Kencha

  • Depndng on chkbox, should display selection screen block on selectionscreen

    Hi,
    Depending upon the chkbox it should display selection screen block on selection screen. 
    If not checked it should display B3 and If checked it should display Block B2 .
    SELECTION-SCREEN BEGIN OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS P_DAT AS CHECKBOX USER-COMMAND FLAG.
    SELECTION-SCREEN COMMENT 3(79) text-112.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-109.
    PARAMETER:      p_year1   LIKE ce1rh03-gjahr,
                    p_perid1  LIKE ce1rh03-perde.
    SELECTION-SCREEN END OF BLOCK B2.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-109.
    PARAMETER:      p_year    LIKE ce1rh03-gjahr MODIF ID MO1,
                             p_period  LIKE ce1rh03-perde MODIF ID MO1.
    SELECTION-SCREEN END OF BLOCK B3.
    If P_Dat is checked     .... It should display the Block B2 and
    If p_Dat is not checked .... it should display the Block B3
    Any suggestions will be appreciated!
    Regards,
    Kittu

    Hello Kittu,
    You can try this code:
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS p_dat AS CHECKBOX USER-COMMAND flag.
    SELECTION-SCREEN COMMENT 3(79) text-112.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-109.
    PARAMETER:      p_year1   TYPE gjahr MODIF ID mo1,
                    p_perid1  TYPE perio MODIF ID mo1.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-110.
    PARAMETER:      p_year    TYPE gjahr MODIF ID mo2,
                    p_period  TYPE perio MODIF ID mo2.
    SELECTION-SCREEN END OF BLOCK b3.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF p_dat = 'X' AND screen-group1 = 'MO2'.
          screen-active = '0'.
        ELSEIF p_dat <> 'X' AND screen-group1 = 'MO1'.
          screen-active = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    Hope this helps.
    BR,
    Suhas

  • My iPad suddenly started displaying "Searching" up in the top left corner and now the ipad reboots itself after about 2-5 minutes.

    My iPad suddenly started displaying "searching" up in the top left corner of the screen and the wifi symbol is next to it and I am connected to the wifi. Prior to last weekend it used to display Verizon and everything was fine. After about 2-5 minutes the iPad suddenly reboots itself. Can anyone assist with this. Thank you

    Have you tried rebooting the iPad?
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

Maybe you are looking for

  • Firefox freezes for a period of time when I try to fill out online info

    When I begin to fill out forms on line, the first few letters show up but then Firefox freezes for 15-60 seconds before the next letter is entered and does this with all of the letters I entered after thel initial freeze which is just what happened.

  • Error while executing the standard API in HRMS

    Hi Amigos, Currently i am working on the api "hr_personal_pay_method_api.create_us_personal_pay_method" while i try to run a procedure with hard coding some values passing to this api, i am getting the following error. ORA-20001: The legislation for

  • Oracle user can't see all files in a folder. Why?

    I've installed oracle 10g (32 bit) in Oracle EL (32 bit). When I attempt to start the database from the oracle user, it throws the following error: ORA-01078:failure in processing system parameters LRM-00109:could not open parameter file '/u01/app/or

  • Dealer Excise details Capture

    Guru I want the details procedure  & configuration require  for dealer invoice received from vendor to  capture the excise details. Sudhir

  • Need help converting MS SQL query into Oracle, Function 'WHERE' issues

    SELECT PERS_NBR, PAY_ID, PAY_CODE, LOGICAL_DATE, LOGICAL_DATE AS END_DATE, PCNAMES + REPLICATE(',', 39 - (LEN(PCNAMES) - LEN(REPLACE(PCNAMES, ',', '')))) AS PC_NAMES_FINAL FROM (SELECT DISTINCT A.PAY_ID, A.PAY_CODE, A.PERS_NBR, A.LOGICAL_DATE, PCNAME