-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
7u40
-
OS X 10.8.4 (12E55), JavaFX 2.2.40-b43
According to http://docs.oracle.com/javafx/2/api/javafx/stage/DirectoryChooser.html#showDialog%28javafx.stage.Window%29 we expect the following behaviour:
"If the owner window for the directory selection dialog is set, input to all windows in the dialog's owner chain is blocked while the dialog is being shown."
This works on Linux and Windows but at least not (anymore?) on Mac OS X 10.8.4 using JavaFX 2.2.40. The system dialog the DirectoryChooser creates is not modal anymore.
Here is a SSCCE to reproduce this issue:
-----
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
import java.io.File;
public class DirectoryChooserNotModalMain extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
System.out.println(System.getProperties().get("javafx.runtime.version"));
final Label label = new Label("- Click into the textfield.\n- Move the new DirectoryChooserDialog to the side.\n- Click the textfield again!");
final TextField field = new TextField("click me ... ");
field.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(final MouseEvent actionEvent) {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("This Dialog is not modal on Mac OS X");
File directory = directoryChooser.showDialog(field.getScene().getWindow());
if (directory != null) {
field.setText(directory.getAbsolutePath());
}
}
});
VBox root = new VBox();
root.setSpacing(10);
root.setPadding(new Insets(10));
root.getChildren().addAll(label, field);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
}
-----
"If the owner window for the directory selection dialog is set, input to all windows in the dialog's owner chain is blocked while the dialog is being shown."
This works on Linux and Windows but at least not (anymore?) on Mac OS X 10.8.4 using JavaFX 2.2.40. The system dialog the DirectoryChooser creates is not modal anymore.
Here is a SSCCE to reproduce this issue:
-----
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
import java.io.File;
public class DirectoryChooserNotModalMain extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
System.out.println(System.getProperties().get("javafx.runtime.version"));
final Label label = new Label("- Click into the textfield.\n- Move the new DirectoryChooserDialog to the side.\n- Click the textfield again!");
final TextField field = new TextField("click me ... ");
field.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(final MouseEvent actionEvent) {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("This Dialog is not modal on Mac OS X");
File directory = directoryChooser.showDialog(field.getScene().getWindow());
if (directory != null) {
field.setText(directory.getAbsolutePath());
}
}
});
VBox root = new VBox();
root.setSpacing(10);
root.setPadding(new Insets(10));
root.getChildren().addAll(label, field);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
}
-----
- duplicates
-
JDK-8123950 DirectoryChooser.setInitialDirectory(File) pays no attention to the parameter value.
-
- Resolved
-