com.ccg.swing
Class DirChooser

java.lang.Object
  extended by com.ccg.swing.DirChooser

public class DirChooser
extends Object

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:

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();
  }
}
 

Since:
1.0
Version:
$Revision: 1.1 $
Author:
$Author: pkb $

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

DirChooser

public DirChooser()
Fully constructs the object with the users home directory as the initial location.

Since:
1.0
See Also:
setDirectory(java.io.File)
Method Detail

getComponent

public JComponent getComponent()
Get the GUI component which allows the user to choose a specific directory.

Returns:
The Swing component which the user interacts with to choose a directory.
Since:
1.0

setDirectory

public void setDirectory(File val)
Set the selected directory.

Parameters:
val - New directory to assign - must not be null.
Throws:
IllegalArgumentException - If the directory passed was unacceptable.
See Also:
getDirectory()

getDirectory

public File getDirectory()
Get the selected directory.

Returns:
Last selected/set directory.
See Also:
setDirectory(java.io.File)


Copyright 1998-1998-2006 null. All Rights Reserved.