-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b55
-
x86
-
os_x
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8018900 | 7u45 | Sergey Bylokhov | P3 | Closed | Fixed | b01 |
JDK-2225091 | 7u40 | Sergey Bylokhov | P3 | Closed | Fixed | b06 |
FULL PRODUCT VERSION :
OpenJDK Runtime Environment (build 1.7.0-jdk7u4-b19-20120410)
OpenJDK 64-Bit Server VM (build 23.0-b20, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Mac OS 10.7 Lion
EXTRA RELEVANT SYSTEM CONFIGURATION :
Using OpenJDK-OSX-1.7-x64-u4-jdk-jdk7u4-b19 as the runtime.
A DESCRIPTION OF THE PROBLEM :
CAN NOT GET THE FOLDER NAME BY SETTING THE SYSTEM PROPERTY ...
apple.awt.fileDialogForDirectories SET TO true.
THE FILE DIALOG BUTTON STILL SAYS OPEN AS IF TO SELECT A FILE RATHER THAN A DIRECTORY. THIS FORCES USERS TO INSTEAD USE THE FILECHOOSER WHICH DOES NOT CONTAIN NATIVE BEHAVIORS MAC USERS EXPECT TO SEE IN THE FILE DIALOGS.
ON APPLE JAVA 1.6 IT DOES WORK.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run src below.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
SHOULD HAVE A java.awt.FileDialog WITH A [CHOOSE] BUTTON TO SELECT A FOLDER
ACTUAL -
INSTEAD GET AN [OPEN] BUTTON TO ONLY SELECT FILES.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SelectFolderFrame extends JFrame {
public static void main(String[] args){
new SelectFolderFrame();
}
public SelectFolderFrame(){
this.setLayout(new FlowLayout());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton clickMe = new JButton("Click Me");
clickMe.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog chooser = new FileDialog(SelectFolderFrame.this, "Select Target Folder ");
System.setProperty("apple.awt.fileDialogForDirectories", "true");
chooser.setVisible(true);
if (chooser.getDirectory() != null) {
String folderName = chooser.getDirectory();
folderName += chooser.getFile();
//CAN NOT GET THE FOLDER NAME BY SETTING THE SYSTEM PROPERTY.
//THE FILE DIALOG BUTTON STILL SAYS OPEN AS IF TO SELECT A FILE
//RATHER THAN A DIRECTORY.
//ON APPLE JAVA 1.6 IT DOES.
}
}
});
this.getContentPane().add(clickMe); this.pack();
this.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
USE A javax.swing.JFileChooser INSTEAD
OpenJDK Runtime Environment (build 1.7.0-jdk7u4-b19-20120410)
OpenJDK 64-Bit Server VM (build 23.0-b20, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Mac OS 10.7 Lion
EXTRA RELEVANT SYSTEM CONFIGURATION :
Using OpenJDK-OSX-1.7-x64-u4-jdk-jdk7u4-b19 as the runtime.
A DESCRIPTION OF THE PROBLEM :
CAN NOT GET THE FOLDER NAME BY SETTING THE SYSTEM PROPERTY ...
apple.awt.fileDialogForDirectories SET TO true.
THE FILE DIALOG BUTTON STILL SAYS OPEN AS IF TO SELECT A FILE RATHER THAN A DIRECTORY. THIS FORCES USERS TO INSTEAD USE THE FILECHOOSER WHICH DOES NOT CONTAIN NATIVE BEHAVIORS MAC USERS EXPECT TO SEE IN THE FILE DIALOGS.
ON APPLE JAVA 1.6 IT DOES WORK.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run src below.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
SHOULD HAVE A java.awt.FileDialog WITH A [CHOOSE] BUTTON TO SELECT A FOLDER
ACTUAL -
INSTEAD GET AN [OPEN] BUTTON TO ONLY SELECT FILES.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SelectFolderFrame extends JFrame {
public static void main(String[] args){
new SelectFolderFrame();
}
public SelectFolderFrame(){
this.setLayout(new FlowLayout());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton clickMe = new JButton("Click Me");
clickMe.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog chooser = new FileDialog(SelectFolderFrame.this, "Select Target Folder ");
System.setProperty("apple.awt.fileDialogForDirectories", "true");
chooser.setVisible(true);
if (chooser.getDirectory() != null) {
String folderName = chooser.getDirectory();
folderName += chooser.getFile();
//CAN NOT GET THE FOLDER NAME BY SETTING THE SYSTEM PROPERTY.
//THE FILE DIALOG BUTTON STILL SAYS OPEN AS IF TO SELECT A FILE
//RATHER THAN A DIRECTORY.
//ON APPLE JAVA 1.6 IT DOES.
}
}
});
this.getContentPane().add(clickMe); this.pack();
this.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
USE A javax.swing.JFileChooser INSTEAD
- backported by
-
JDK-2225091 [macosx] awt.FileDialog doesn't respond appropriately for mac when selecting folders
- Closed
-
JDK-8018900 [macosx] awt.FileDialog doesn't respond appropriately for mac when selecting folders
- Closed
- duplicates
-
JDK-8000430 [macosx] Add directories selection support in the java.awt.FileDialog
- Closed
- relates to
-
JDK-2225085 Directory Selection standard dialog support
- Closed
-
JDK-6927978 Directory Selection standard dialog support
- Open
-
JDK-8000430 [macosx] Add directories selection support in the java.awt.FileDialog
- Closed
(1 relates to)