history https://www.gremwell.com/ en Autocomplete and Input History for MagicTree https://www.gremwell.com/gremwell-history <span>Autocomplete and Input History for MagicTree</span> <div><h3>Components for Java Swing</h3> <p>Most modern user interfaces remember user input and provide autocomplete function. When you start typing a URL in a browser location bar, you get a list of URLs matching the pattern you have typed.<br /><br /> We wanted similar functionality for MagicTree. Whenever user has to type something, whether it is a command line, an XPath expression or a search term, we wanted the application to remember the previous input and provide autocompletion. Now we have that:<br /><img src="http://www.gremwell.com/sites/default/files/autocomplete1.png" alt="Autocomplete in Query Editor table" /><br /></p> <p><img src="http://www.gremwell.com/sites/default/files/autocomplete2.png" alt="Autocomplete in command line" /></p> <p>This functionality seems to be generally useful, so I decided to publish the components I have developed.<br /><br /> The main building block of the History package is the History class. It is not a GUI component, but rather a store for user input history. It is backed by Java preferences, so input history is stored between application invocations. This class also keeps statistics about the usage of each history item, so the user is presented with suggestions with most often used strings coming first. This class also allows to have multiple separate input histories in the application. For example, you may want to have a separate history for street name field and for city name field.<br /><br /> The package provides three GUI components: HistoryTextField inherited from JTextField, HistoryComboBox inherited from JComboBox and HistoryCellEditor implementing TableCellEditor interface. You can also use HistoryDocument inherited from PlainDocument to provide autocompletion for any other GUI component inherited from JTextComponent.<br /><br /> Download [attachment:gremwell-history.jar=binary jar], [attachment:gremwell-history-src.zip=source code], and [attachment:gremwell-history-javadoc.zip=javadoc] for gremwell-history package.</p> <p><b>Update:</b> I have uploaded a new version. It fixes a problem preventing long history entries (Java preferences only allows keys up to 80 characters long) and a bug in HistoryComboBox which caused autocomplete when the component lost focus. </p> </div> <span><span lang="" about="/user/10" typeof="schema:Person" property="schema:name" datatype="">alla</span></span> <span>Thu, 02/11/2010 - 18:54</span> Thu, 11 Feb 2010 17:54:40 +0000 alla 37 at https://www.gremwell.com