< prev index next >
src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -838,11 +838,11 @@
// Make a file from the filename
File makeFile(final JFileChooser fc, final String filename) {
File selectedFile = null;
// whitespace is legal on Macs, even on beginning and end of filename
- if (filename != null && !filename.equals("")) {
+ if (filename != null && !filename.isEmpty()) {
final FileSystemView fs = fc.getFileSystemView();
selectedFile = fs.createFileObject(filename);
if (!selectedFile.isAbsolute()) {
selectedFile = fs.createFileObject(fc.getCurrentDirectory(), filename);
}
@@ -851,11 +851,11 @@
}
// Utility to tell if the textfield has anything in it
boolean textfieldIsValid() {
final String s = getFileName();
- return (s != null && !s.equals(""));
+ return (s != null && !s.isEmpty());
}
// Action to attach to the file list so we can override the default action
// of the table for the return key, which is to select the next line.
@SuppressWarnings("serial") // Superclass is not serializable across versions
@@ -1958,11 +1958,11 @@
// Try to get the custom text. If none, use the fallback
String getApproveButtonText(final JFileChooser fc, final String fallbackText) {
final String buttonText = fc.getApproveButtonText();
if (buttonText != null) {
buttonText.trim();
- if (!buttonText.equals("")) return buttonText;
+ if (!buttonText.isEmpty()) return buttonText;
}
return fallbackText;
}
int getApproveButtonMnemonic(final JFileChooser fc) {
@@ -1977,11 +1977,11 @@
String getApproveButtonToolTipText(final JFileChooser fc, final String fallbackText) {
final String tooltipText = fc.getApproveButtonToolTipText();
if (tooltipText != null) {
tooltipText.trim();
- if (!tooltipText.equals("")) return tooltipText;
+ if (!tooltipText.isEmpty()) return tooltipText;
}
return fallbackText;
}
String getCancelButtonToolTipText(final JFileChooser fc) {
< prev index next >