org.gnome.gtk

Class FileChooserButton

Implemented Interfaces:
FileChooser

public class FileChooserButton
extends HBox
implements FileChooser

Displays a filename and a Button which, if pressed, opens a FileChooserDialog allowing the user to select the file.

This Widget implements the FileChooser interface, which has most of the methods necessary to manipulate the selection in the Widget.

Note that FileChooserButton only supports selecting files (mode OPEN) or directories (mode SELECT_FOLDER). If you need something more complicated, then you'll need to use wrap a FileChooserWidget in a custom Widget or launch a FileChooserDialog.

Author:
Andrew Cowie
Since:
4.0.2
See Also:
FileChooserWidget, FileChooserDialog

Nested Class Summary

Nested classes/interfaces inherited from class org.gnome.gtk.Widget

Widget.ENTER_NOTIFY_EVENT, Widget.FOCUS_OUT_EVENT

Constructor Summary

FileChooserButton(String title, FileChooserAction action)
Creates a new FileChooserButton.

Method Summary

void
connect(SELECTION_CHANGED handler)
String
getCurrentFolder()
String
getFilename()
URI
getURI()
boolean
setCurrentFolder(String directory)

Methods inherited from class org.gnome.gtk.Box

packStart, packStart

Methods inherited from class org.gnome.gtk.Container

add, remove

Methods inherited from class org.gnome.gtk.Widget

connect, connect, getParent, show, showAll

Methods inherited from class org.freedesktop.bindings.Proxy

toString

Constructor Details

FileChooserButton

public FileChooserButton(String title,
                         FileChooserAction action)
Creates a new FileChooserButton. The selected file is unset, and will appear as "(none)" in the display.
Parameters:
title - a title for the FileChooserDialog when it is popped.
action - which style of FileChooser you want. Only OPEN (selecting a single file), and SELECT_FOLDER, (selecting a single directory) are enabled for FileChooserButton.

Method Details

connect

public void connect(SELECTION_CHANGED handler)

getCurrentFolder

public String getCurrentFolder()
Specified by:
getCurrentFolder in interface FileChooser

getFilename

public String getFilename()
Specified by:
getFilename in interface FileChooser

getURI

public URI getURI()
Specified by:
getURI in interface FileChooser

setCurrentFolder

public boolean setCurrentFolder(String directory)
Specified by:
setCurrentFolder in interface FileChooser