Customizing the Directory Selection Dialog: set title and message : DirectoryDialog « SWT « Java Tutorial






  1. Call setText(), passing the desired text, to change what's displayed in the title bar.
  2. Call setMessage(), passing your custom message, to change the message text.
Customizing the Directory Selection Dialog: set title and message
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class DirectoryDialogTextMessage {

  public static void main(String[] args) {
    Display display = new Display();
    final Shell shell = new Shell(display);

    DirectoryDialog dlg = new DirectoryDialog(shell);
    dlg.setText("My Text");
    dlg.setMessage("My Message");
    String selectedDirectory = dlg.open();

    System.out.println(selectedDirectory);
    
    display.dispose();

  }
}








17.104.DirectoryDialog
17.104.1.Creating the dialog and retrieving the selected directoryCreating the dialog and retrieving the selected directory
17.104.2.Set Filter PathSet Filter Path
17.104.3.Customizing the Directory Selection Dialog: set title and messageCustomizing the Directory Selection Dialog: set title and message