All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.TextPreview
java.lang.Object
|
+----java.awt.Component
|
+----com.sun.java.swing.TextPreview
- public class TextPreview
- extends Component
- implements FilePreview
A component to preview a text file, intended to fit into the
preview slot of a FileChooser. In normal usage, only the
ask method is of interest: it pops up a dialog box with
a FileChooser containing an instance of this previewer and
filtering for appropriate files.
-
TextPreview()
-
-
ask(JFrame, String, File, ChangeListener, FileChooserFilter)
- Convenience method to prompt for the name of a text file.
-
getMinimumSize()
-
-
getPreferredSize()
-
-
paint(Graphics)
-
-
setBounds(int, int, int, int)
-
-
setPreviewFile(File)
-
-
setSize(int, int)
-
TextPreview
public TextPreview()
ask
public static File ask(JFrame parent,
String title,
File dfc,
ChangeListener target,
FileChooserFilter fcf)
- Convenience method to prompt for the name of a text file.
For example:
File f = ImagePreview.ask(null,"Open file",previousFile,
null,new FileChooserFilter("Config file (cfg)"));
- Parameters:
- fparent - the parent frame for the dialog box.
fparent may be null if a default parent has
been established with StandardDialog
- description - a description string that will be shown
to the user to indicate what is being requested
- initial - the initial value for the string
- columns - the default width (in 'm's) of the TextField
- target - the ChangeListener that will be informed if the
OK or Apply buttons are hit.
- fcf - a FileChooserFilter for selecting the
file names to be presented in the dialog box.
- Returns:
- If target is null,
the dialog box will be modal and the method
will return the final result, or null if cancelled.
Otherwise, the
dialog box is non-modal, the method returns null
immediatly, and the listener is informed when
appropriate. The source of the change event will
be a FileChooser.
- See Also:
- StandardDialog
setPreviewFile
public void setPreviewFile(File f)
setSize
public void setSize(int w,
int h)
- Overrides:
- setSize in class Component
setBounds
public void setBounds(int x,
int y,
int width,
int height)
- Overrides:
- setBounds in class Component
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
- getPreferredSize in class Component
getMinimumSize
public Dimension getMinimumSize()
- Overrides:
- getMinimumSize in class Component
paint
public void paint(Graphics g)
- Overrides:
- paint in class Component
All Packages Class Hierarchy This Package Previous Next Index