All Packages Class Hierarchy This Package Previous Next Index
Class framework.awt.FileField
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----framework.awt.FileField
- public class FileField
- extends Panel
A component that can be used to specify the name of a file. The user
can simply type a filename into a TextField, or he or she can select a
file using a FileDialog that can be activated by a pressing a button
in the FileField. FileField is a subclass of java.awt.Panel because
it consists of more than one component.
If an application wants to be notified when the filename in the
FileField changes (either by the user pressing return in the TextField
or by getting a new selection from the FileDialog), it should
implement the ActionListener interface and register the new listener
to receive events from the FileField, by calling the
addActionListener() method. The new filename is available to the
application through the action event's command.
The FileField can also be queried for the current filename using
method getFilename().
- Version:
- $Revision: 1.5 $
- See Also:
- ActionListener, getActionCommand, addActionListener, getFilename, TextField, FileDialog
-
FileField(Frame, String)
- Constructs a new FileField.
-
addActionListener(ActionListener)
- Adds the specified action listener to receive action events from this
FileField.
-
getFilename()
- Get the filename that is represented by this FileField.
-
processActionEvent(ActionEvent)
-
Processes action events occurring on this TextField by dispatching
them to any registered ActionListener objects.
-
processEvent(AWTEvent)
- Processes events on this FileField.
-
removeActionListener(ActionListener)
- Removes the specified action listener so that it no longer receives
action events from this FileField.
-
setFilename(String)
- Set the filename represented by this FileField to be the specified
filename.
FileField
public FileField(Frame parent,
String initialFilename)
- Constructs a new FileField.
- Parameters:
- parent
- the owner of the FileField.
- initialFilename
- a String to display in the FileField. The preferred size of
the FileField is based on the length of this String.
addActionListener
public void addActionListener(ActionListener l)
- Adds the specified action listener to receive action events from this
FileField. Action events occur when the user selects a new filename.
- Parameters:
- l - the action listener
- See Also:
- ActionListener, removeActionListener
removeActionListener
public void removeActionListener(ActionListener l)
- Removes the specified action listener so that it no longer receives
action events from this FileField.
- Parameters:
- l - the action listener
- See Also:
- ActionListener, addActionListener
getFilename
public String getFilename()
- Get the filename that is represented by this FileField. The returned
name is the complete text as entered in the TextField or selected by
the FileDialog. It can contain an optional directory name.
- See Also:
- setFilename
setFilename
public void setFilename(String filename)
- Set the filename represented by this FileField to be the specified
filename.
- Parameters:
- filename - the new filename.
- See Also:
- getFilename
processEvent
protected void processEvent(AWTEvent e)
- Processes events on this FileField. If the event is an ActionEvent, it
invokes the processActionEvent method, else it invokes its
superclass's processEvent.
- Parameters:
- e - the event.
- Overrides:
- processEvent in class Container
processActionEvent
protected void processActionEvent(ActionEvent e)
- Processes action events occurring on this TextField by dispatching
them to any registered ActionListener objects. NOTE: This method will
not be called unless action events are enabled for this component;
this happens when one of the following occurs: a) An ActionListener
object is registered via addActionListener() b) Action events are
enabled via enableEvents()
- Parameters:
- e - the action event
- See Also:
- enableEvents
All Packages Class Hierarchy This Package Previous Next Index