How to implement auto complete using swings?

Hi all ,
i have got a new assignment where I have to implement auto complete. Please suggest me the possible ways to do so. I am working on desktop application.
Please help.
Thanks
Alex

Till now i have tried this:-
public class AutoCompletePer extends JFrame
     private JTextField field = new JTextField(40);
     private JFrame frame1 = new JFrame();
     private boolean showAutoComplete = true;
     public AutoCompletePer()
          setSize(500,300);
          setLocation(300,50);
          setLayout(new FlowLayout());
          getContentPane().add(field);
          setVisible(true);
          setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
          addListeners();
     private void addListeners()
           field.getDocument().addDocumentListener(new DocumentListener() {
            public void removeUpdate(DocumentEvent e)
           public void insertUpdate(DocumentEvent e)
                 if(showAutoComplete)
                      SwingUtilities.invokeLater(new Runnable() {
                    public void run()      {
                    Point p = field.getLocationOnScreen();
                       frame1.setBackground(Color.white);
                    frame1.setSize(field.getWidth(), 200);
                    frame1.setLocation(p.x ,p.y+20);
                    frame1.setVisible(true);
                    frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    JPanel panel = new JPanel(new BorderLayout());
                    panel.setBackground(Color.WHITE);
                    panel.add(new JLabel("i am label"));
                    frame1.getContentPane().add(panel,BorderLayout.CENTER);
                    showAutoComplete = false;
                    requestFocus();
                    field.requestFocus();
                      public void changedUpdate(DocumentEvent e) {
     public static void main(String[] args) {
          new AutoCompletePer();
}I tried this but it doesn't work atleast frame should remain infront of the main window, even I tried with dialog box but all in vain.
Please suggest if there is any API defined for this in Java or any other wayOut.
Please help.
Alex

Similar Messages

  • How to implement route cipher using java?

    Hi guys,,,
    I really got a headache solving how to implement route cipher using java lang,,i already got the concept but i really dont get how to implement it using java actually i want to make a presentation of how route cipher works using "adobe flash" but first i will implement it using java coz flash actionscripts are closer to java lang.
    Hope you could post some examples or ideas...i would really appreciate it!
    thank you so much...

    just add an action listener (either keypressed or keytyped) to the frame that you want to record. I did this in NetBeans in about 2 seconds. I can simplify it if you need. As for loging it just write the characters to a file output stream.
    public class test extends javax.swing.JFrame {
        /** Creates new form test */
        public test() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyTyped(java.awt.event.KeyEvent evt) {
                    formKeyTyped(evt);
            pack();
        // </editor-fold>
        private void formKeyTyped(java.awt.event.KeyEvent evt) {
            System.out.println(evt.getKeyChar());
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new test().setVisible(true);
        // Variables declaration - do not modify
        // End of variables declaration
    }

  • Help!!! How to implement a special useful button in tool bar?

    How to implement a special useful button in tool bar, when the button is clicked, then a menu shows under the button, just like the Internet Explorer's back button and forward button, there is a black arrow at the two buttons right, when click the black arrow, a menu shows under the back button or forward button, how to implement this in java?
    Please help!!!
    Thanks!!!

    Like an enhanced JComboBox?
    ;o)
    V.V.

  • Explain how to implement prompt functionality using @variable

    Hi all,
    Anyone please explain how to implement prompt functionality using @variable.
    We got some sql reports.Those reports have to be converted into BO free hand sql report.
    Please provide any best practices for converting sql reports into BO free hand SQL.
    Thanks & Regards,
    James Charle

    Hi
    Please refer "@Variable" section  in page number 601, in http://help.sap.com/businessobject/product_guides/boexir31SP3/en/xi31_sp3_designer_en.pdf
    Regards
    Ashwini

  • How to implement Auto Suggest Widget

    Hi there
    I have a dynamic asp classic page, where the data come from an access db.
    On this page, many documents (category and title ) are displayed for download.
    I want to implement Auto Suggest Widget in order to find the document easier and to jump to it (href="#document_xy") directly for download.
    I don't have a clue on how to implement the Auto Suggest Widget.
    The ASP sample works with XML File.
    http://labs.adobe.com/technologies/spry/samples/autosuggest/SuggestSample.html
    All replies, hints, tutorials are highly appreciated.
    kind regards
    joey00x
    I am using Win XP, Dreamweaver CS3

    Hi,
    thanks for trying to help.
    I am sorry to ask again. I am not at all familiar with xml.
    I have tried to modify the ASP script you've suggested, but I get strange XML error, which doesn't make sense to me.
    I understand that with the script the server creates an XML File on the fly. First I have to connect to my access database, then I fill the records into a recordset object. And then the server loops through the RS and creates the xml file. Is that correct?
    The error message I get, points to a complete different place in the code, to a javascript module, which is working perfectly without below code.
    Any suggestions where the bug is?
    Thanks for your time
    kind regards
    joey00x
    Here the code that I am using:
    <%
    Dim objRS
    Dim SQLxml
    SQLxml = "Select category, subcategory, title from DocumentView"
    Set objRS=Server.CreateObject("ADODB.Recordset")
    objRS.Open SQLxml , objConn, 0, 1
    ' Send the headers
    Response.ContentType = "text/xml"
    Response.AddHeader "Pragma", "public"
    Response.AddHeader "Cache-control", "private"
    Response.AddHeader "Expires", "-1"
    %>
    <?xml version="1.0" encoding="utf-8"?>
    <root>
      <% While (NOT objRS.EOF) %>
        <row>
             <%
                For each field in objRS.Fields
                column = field.name
             %>
            <<%=column%>><![CDATA[<%=(objRS.Fields.Item(column).Value)%>]]></<%=column%>>
            <%
                Next
            %>
        </row>
        <%
          objRS.MoveNext()
        Wend
        %>
    </root>
    <%
    objRS.Close()
    Set objRS = Nothing
    %>

  • How to disable auto-complete in tables?

    Neither in the Preferences, nor the "Edit"-menu, or even the "Table"-tab in the "Inspector" can I find a way to disable the auto-completion in tables [that automatically inserts the content from other table cells when I start typing].
    The auto-completion is driving me nuts: I want to write the new cell content, and "tab" to the next cell, but I can't, because the auto-completion leaves something else than what I wrote in the cell when I tab out of it.
    So how do I get rid of this mis-feature?

    Hi,
    Recently I needed to use this feature, and after some research I found the answer.
    Just sharing the solution.
    I am aware that the auto-complete is a browser setting. But is there a way to let APEX not save the items entered before? Write a javascript?
    Because I have implemented Google suggest for a text field. Every time the suggestions pop up, the auto-complete items will also appear at the same time, which is very annoying.Put on your Page Item > Element > HTML Form Element Attributes : autocomplete="off"
    Bytes

  • How to create Auto complete text box in share point 2010 Visual web part

    Hi All ,
    I am want to use Auto complete text box in share point 2010 Visual web part ,data need to get from share point list how to  create 
    please guide me how to use Auto complete text box
    Thanking you,
    Arun Darly

    Hi Arun,
    Please refer to the following article.
    SharePoint 2010: JQuery Autocomplete Textbox Containing List Items
    http://smarttools.codeplex.com/wikipage?title=Autocomplete%20Text%20Field
    Please don't forget to mark it as answered, if your problem resolved or helpful.

  • How to disable auto-complete for a text field?

    I didn't find any attribute that controls this. Thanks!

    Hi,
    Recently I needed to use this feature, and after some research I found the answer.
    Just sharing the solution.
    I am aware that the auto-complete is a browser setting. But is there a way to let APEX not save the items entered before? Write a javascript?
    Because I have implemented Google suggest for a text field. Every time the suggestions pop up, the auto-complete items will also appear at the same time, which is very annoying.Put on your Page Item > Element > HTML Form Element Attributes : autocomplete="off"
    Bytes

  • How to implement wafer mapping using LabVIEW?

    Hello LabVIEW Masters!
    I am having an incoming project which includes controlling and gathering information from a PROBER. One of the difficulties I am having now is how to implement a WAFER MAP using LabVIEW. According to my customer requirements, the wafer element ranges from 6k to 23k. I guess doing all the element (one die = one led ctl/indicator) will be a hell of a task, especially on how to effectively manipulate each elements. Does anyone have better idea on how to this?
    Please, I badly need your help.. 
    Thanks and Regards,
    Dennis DG
    Solved!
    Go to Solution.

    Hi Dennis,
    Is it okay if you send to me the working VI also?
    No, it's not ok. I made that program for my customer...
    As I am not too familiar in using intensity graph.
    That's no reason to hand over programs for free...
    My customer also request me that if the cursor hover on the wafer map, he wants the x,y corrdinates to be displayed.
    I also have such a feature. Did you notice the little yellow cursor near the center of the wafer? One could easily change that to use a MouseMove event instead...
    He also wants to select some elements in the wafer map and come up with the coordinate values to do some testing.
    That's related to the cursor thing...
    Some points:
    - You have a customer that pays you. Why should I offer work for free?
    - You can send me contact dates of your customer, I will make him an offer...
    - When you take an job to provide software you should be able to code the software...
    - The VI(s) are now some years old. I didn't code so well back those days and don't want to hand out those VIs as they are right now.
    - I included some "license management" deep inside that program, I would have to remove this and spend time on testing afterwards...
    - The VIs are based on the PROBER output format used by the customer. All the file handling has to be changed for/by you...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to implement Oracle DWH using JDBC

    Hello,
    i'm new to the Oracle database and i'm wondering how to implement a DWH Core or Datamart System using Oracle 11g Express. How can i "switch" a relational oracle database to a dimensional one, preparing it for OLAP/BI queries´, preferably using the JDBC interface ?
    Thanks a lot!

    An good introduction to Oracle OLAP is found on the OTN site: Oracle OLAP.
    --Ken Chin

  • How to Implement Auto tabbing feature in a table region???

    Hi All,
    I am trying to implement auto tabbing feature in one of my OAF page using java script which is actually working for individual items but
    while implementing the same for a table bean its not working. is there any way to implement this feature in OAF without using java script?
    if not could anyone give some rough java script for this feature? please this is urgent..
    Thanks in advance
    Sree

    Sree,
    check this if it helps ;
    https://forums.oracle.com/thread/963732
    Not sure we can set Focus in : PFR ,  I hope it is possible in only PR.
    Regards
    Sridhar

  • How to reset auto completion?

    Hello,
    I know how to disable the auto-completion in Numbers but how can I reset this feature? In some cells it completes integer numbers to dates but only the zeros and the ones and not in every table of the document.
    Regards,
    Steffen

    Do you mean auto completion on an individual cell or auto completion of text?
    In the Inspector under Cells, Cell Format can be Automatic - this means that text entered like dates (4/10) are converted to dates: 4th October 2007.
    To reset on individual cells - select the cells and in the Inspector, Cells, Cell Format choose 'Automatic' from the drop down menu. When a date is entered it is formatted as a date, if afterwards you enter a basic number (10.1) in the cell it will be reformatted as a number.
    Neil.
    Message was edited by: N.P.

  • How to enable Auto Complete option in SAP

    Hello Guru,
    i want to enable my auto complete option in my system so as to get the past transaction or any codes quickly by pressing SPACEBAR, all other systems have this feature, they just by pressing spacebar get their TCodes or any inputs instead of typing the whole.
    i also tried by getting into customizing layout in SAP system and turned on its history, but still its not coming. what may be the reason???.
    all my colleagues have this feature in their system. and even after changing their setting its coming
    pls revert asap, as i will not waste my time in writing the whole Tcodes.

    Jigar,
    SAP calls this 'Local Data', it is a function of your GUI settings and not of SAP config.
    Open an SAP session using the gui.  I am using gui 7.2, the location of this command has changed a bit over the various GUI versions, but I will get you into the general area.  On the top icon bar, select the colorful icon on the right > options.  Find Local Data (either a tab or a menu item).  Under History, select 'On'.  Make any other settings that meet your fancy.  Then, Apply > OK.
    Log off, then log on.  Your local data should now be enabled.
    Best Regards,
    DB49

  • Hello, everyone, can anyone tell me how to implement auto cash?

    hello everyone :
          who can tell me how to implement the business process of Auto Cash in Sap,  could't thank you more.
          Best Regards.
                                                                   Frank .

    hello, frank.
    could you please explain the "Auto Cash" scenario a little more?  we might know it by another term.
    regards.

  • How to implement schedule workflow using SharePoint Designer?

    Hi All,
    Please let me know , How to implement the schedule workflow using Share Point Designer.
    Thank You.
    Regards,
    ~Sri

    +1 to this. The closest that you'll get with list / level features is using Information Rights. You can trigger workflows based on time/date columns, which may serve your needs.
    Failing that, you will indeed need a custom timer job.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

Maybe you are looking for