Closed Thread Icon

Topic awaiting preservation: JComboBox Problem... Help Plzzzz..... (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=26053" title="Pages that link to Topic awaiting preservation: JComboBox Problem... Help Plzzzz..... (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: JComboBox Problem... Help Plzzzz..... <span class="small">(Page 1 of 1)</span>\

 
javeo
Obsessive-Compulsive (I) Inmate

From:
Insane since: May 2005

posted posted 06-17-2005 14:42

hi,

i just want to ask how do i prevent JComboBox in the JFileChooser from, going up to the next folder, but i can go to the subfolder of the defaulth path... example
my default path is C:\Temp\data, i can go to the subfolders of C:\Temp\data,
but i cannot go upward like C:\Temp or C:\, in this case if the user goes up,
the JComboBox will force to set the defaulth path.

here are some of the codes...

public void load()
{
.
cJComboBox.addActionListener( this );
..
}


public void actionPerformed(ActionEvent pEvent)
{
Object mSourceObj = pEvent.getSource();
if (mSourceObj.equals(cJComboBox))
{
comboboxChanged();
}
}


private void comboboxChanged()
{
String mlen = cJComboBox.getSelectedItem().toString();

if (currentPath.startsWith(defaultPath))
{
.............
} else {
setCurrentDirectory(new File(defaulthPath)); // im trying to force the JComboBox to return to defaulth path... if the user goes up....
.............
}

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 06-20-2005 05:17

This is an interesting problem, and you will have to work on a solution for this one because it is a non-standard problem.

I would check here http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/filechooser/FileFilter.html

Also look at the example. The file chooser is really not a robust widget. You might want to dig down into the source code for the widget itself to see if you can get a handle on how it work. The JFileChooser extents JCompontent so it must do a whole lot of stuff on its own.

This type of problem might take a while to figure out if the FileFilter doens't work for you.

Good luck.

Dan @ Code Town

« BackwardsOnwards »

Show Forum Drop Down Menu