Results 1 to 3 of 3
- 11-17-2010, 01:16 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 4
- Rep Power
- 0
JFileChooser filename autocompletion
Hello together,
I'm searching for a posibility to complete the filename in a JFileChooser automatically.
Example:
The FileChooser opens a directory with different files, like:
Test1.txt
test.csv
test345.txt
...
If I type e.g. "T" || "t", then the text of the filename-field should be completet to "Test1.txt" || "Test345.txt".
If someone know a way to activate this function in the JFileChooser, please write an answer to this thread.
Thanks !!!!
- 11-18-2010, 10:04 PM #2
Member
- Join Date
- Nov 2009
- Posts
- 4
- Rep Power
- 0
[resolved] JFileChooser filename autocompletion
Problem is resolved by using a FileDialog instead of a JFileChooser.
- 03-25-2011, 05:01 PM #3
Member
- Join Date
- Mar 2011
- Posts
- 4
- Rep Power
- 0
text field cannot be accessed directly
if one has add auto functionality then he/she has to access the text field but that is not possible in normal ways..
A kind of hack was is there which searches for all the components and then finds the instance of textfield and returns it.
here is the code.. :)
and here is the link for class extends JFileChooser that applies autocompleteJava Code:private JTextField dis(JFileChooser jf) { boolean hide =false; LinkedList<Component> queue = new LinkedList<Component>(); queue.add(jf); JTextField jtf=new JTextField(); while(queue.size() != 0) { Component[] c = ((Container) queue.removeFirst()).getComponents(); for(int i = 0; i < c.length; i++) { queue.add(c[i]); if(c[i] instanceof JTextField) { jtf = (JTextField) c[i]; jtf.setVisible(true); jtf.setEnabled(true); jtf.setText(" hello "); return jtf; } } } return jtf; }
http://commondatastorage.googleapis....ser/VinFC.java
Similar Threads
-
New filename after try catch
By hellzxmaker in forum New To JavaReplies: 3Last Post: 11-05-2010, 11:07 PM -
get the size and filename of the jar file run from and SHA
By aztectrev in forum Advanced JavaReplies: 4Last Post: 04-03-2010, 06:20 PM -
How to create jTextField autocompletion
By radix in forum New To JavaReplies: 6Last Post: 11-08-2008, 03:55 PM -
Filename Filter problem
By KevMeistr in forum Advanced JavaReplies: 2Last Post: 06-14-2008, 02:43 AM -
Reading a directory and getting the filename
By mrjunsy in forum Advanced JavaReplies: 1Last Post: 05-10-2008, 02:36 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks