|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.swing.DirChooser
public class DirChooser
Class used to create a Swing component which allows the user to choose a directory.
This class is used to build a simple directory chooser. You use it in the following manner:
set the initial directory.Swing Component to your GUI.getDirectory method when you want
to inspect what directory the user chose.Here is a simple example:
import com.ccg.swing.*;
import javax.swing.*;
class Example {
public static void main(String[] args) {
JFrame f = new JFrame("DirChooser");
DirChooser dc = new DirChooser();
f.setContentPane(dc.getComponent());
f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
f.pack();
f.show();
}
}
| Constructor Summary | |
|---|---|
DirChooser()
Fully constructs the object with the users home directory as the initial location. |
|
| Method Summary | |
|---|---|
JComponent |
getComponent()
Get the GUI component which allows the user to choose a specific directory. |
File |
getDirectory()
Get the selected directory. |
void |
setDirectory(File val)
Set the selected directory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DirChooser()
setDirectory(java.io.File)| Method Detail |
|---|
public JComponent getComponent()
public void setDirectory(File val)
val - New directory to assign - must not be null.
IllegalArgumentException - If the directory passed was unacceptable.getDirectory()public File getDirectory()
setDirectory(java.io.File)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||