mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-14 18:03:44 +00:00
8223237: Replace use of string.equals("") with isEmpty() in java.desktop
Reviewed-by: prr
This commit is contained in:
parent
1b03f22dff
commit
133a7aefc1
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -184,7 +184,7 @@ abstract class InputImageTests extends InputTests {
|
||||
String klass = spi.getClass().getName();
|
||||
String format = spi.getFormatNames()[0].toLowerCase();
|
||||
String suffix = spi.getFileSuffixes()[0].toLowerCase();
|
||||
if (suffix == null || suffix.equals("")) {
|
||||
if (suffix == null || suffix.isEmpty()) {
|
||||
suffix = format;
|
||||
}
|
||||
String shortName;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -143,7 +143,7 @@ abstract class OutputImageTests extends OutputTests {
|
||||
String klass = spi.getClass().getName();
|
||||
String format = spi.getFormatNames()[0].toLowerCase();
|
||||
String suffix = spi.getFileSuffixes()[0].toLowerCase();
|
||||
if (suffix == null || suffix.equals("")) {
|
||||
if (suffix == null || suffix.isEmpty()) {
|
||||
suffix = format;
|
||||
}
|
||||
String shortName;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, 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
|
||||
@ -308,7 +308,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
textRect.width = 50;
|
||||
}
|
||||
|
||||
if (text != null && !text.equals("")) {
|
||||
if (text != null && !text.isEmpty()) {
|
||||
final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
|
||||
if (v != null) {
|
||||
v.paint(g, textRect);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@ -52,7 +52,7 @@ class AquaComboBoxRendererInternal<E> extends JLabel implements ListCellRenderer
|
||||
final Dimension size;
|
||||
|
||||
final String text = getText();
|
||||
if ((text == null) || ("".equals(text))) {
|
||||
if (text == null || text.isEmpty()) {
|
||||
setText(" ");
|
||||
size = super.getPreferredSize();
|
||||
setText("");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -840,7 +840,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
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()) {
|
||||
@ -853,7 +853,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// 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
|
||||
@ -1960,7 +1960,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
final String buttonText = fc.getApproveButtonText();
|
||||
if (buttonText != null) {
|
||||
buttonText.trim();
|
||||
if (!buttonText.equals("")) return buttonText;
|
||||
if (!buttonText.isEmpty()) return buttonText;
|
||||
}
|
||||
return fallbackText;
|
||||
}
|
||||
@ -1979,7 +1979,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
final String tooltipText = fc.getApproveButtonToolTipText();
|
||||
if (tooltipText != null) {
|
||||
tooltipText.trim();
|
||||
if (!tooltipText.equals("")) return tooltipText;
|
||||
if (!tooltipText.isEmpty()) return tooltipText;
|
||||
}
|
||||
return fallbackText;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, 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
|
||||
@ -180,7 +180,7 @@ public class AquaInternalFrameBorder implements Border, UIResource {
|
||||
int startXPosition = fThisLeftSideTotal;
|
||||
boolean wasTextShortened = false;
|
||||
// shorten the string to fit in the
|
||||
if ((text != null) && !(text.equals(""))) {
|
||||
if (text != null && !text.isEmpty()) {
|
||||
totalTextWidth = SwingUtilities.computeStringWidth(fm, text);
|
||||
final String clipString = "\u2026";
|
||||
if (totalTextWidth > availTextWidth) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2016, 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
|
||||
@ -141,7 +141,7 @@ public final class AquaInternalFrameDockIconUI extends DesktopIconUI
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) return;
|
||||
String title = fFrame.getTitle();
|
||||
if (title == null || title.equals("")) title = "Untitled";
|
||||
if (title == null || title.isEmpty()) title = "Untitled";
|
||||
fDockLabel = new DockLabel(title);
|
||||
fDockLabel.show(fDesktopIcon);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2013, 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
|
||||
@ -253,9 +253,9 @@ public class AquaMenuPainter {
|
||||
}
|
||||
|
||||
// Draw the accelerator first in case the HTML renderer changes the color
|
||||
if (keyString != null && !keyString.equals("")) {
|
||||
if (keyString != null && !keyString.isEmpty()) {
|
||||
final int yAccel = acceleratorRect.y + fm.getAscent();
|
||||
if (modifiersString.equals("")) {
|
||||
if (modifiersString.isEmpty()) {
|
||||
// just draw the keyString
|
||||
SwingUtilities2.drawString(c, g, keyString, acceleratorRect.x, yAccel);
|
||||
} else {
|
||||
@ -282,7 +282,7 @@ public class AquaMenuPainter {
|
||||
}
|
||||
|
||||
// Draw the Text
|
||||
if (text != null && !text.equals("")) {
|
||||
if (text != null && !text.isEmpty()) {
|
||||
final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
|
||||
if (v != null) {
|
||||
v.paint(g, textRect);
|
||||
@ -342,7 +342,7 @@ public class AquaMenuPainter {
|
||||
// r = iconRect.union(textRect);
|
||||
|
||||
// Add in the accelerator
|
||||
boolean acceleratorTextIsEmpty = (keyString == null) || keyString.equals("");
|
||||
boolean acceleratorTextIsEmpty = (keyString == null) || keyString.isEmpty();
|
||||
|
||||
if (!acceleratorTextIsEmpty) {
|
||||
r.width += acceleratorRect.width;
|
||||
@ -444,7 +444,7 @@ public class AquaMenuPainter {
|
||||
// Force it to do "LEFT", then flip the rects if we're right-to-left
|
||||
SwingUtilities.layoutCompoundLabel(menuItem, fm, text, icon, verticalAlignment, SwingConstants.LEFT, verticalTextPosition, horizontalTextPosition, viewR, iconR, textR, textIconGap);
|
||||
|
||||
final boolean acceleratorTextIsEmpty = (keyString == null) || keyString.equals("");
|
||||
final boolean acceleratorTextIsEmpty = (keyString == null) || keyString.isEmpty();
|
||||
|
||||
if (acceleratorTextIsEmpty) {
|
||||
acceleratorR.width = acceleratorR.height = 0;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2015, 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
|
||||
@ -86,7 +86,7 @@ public final class CFontManager extends SunFontManager {
|
||||
String fontName = f.fullName;
|
||||
String familyName = f.familyName;
|
||||
|
||||
if (fontName == null || "".equals(fontName)) {
|
||||
if (fontName == null || fontName.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
@ -99,7 +99,7 @@ abstract class GIFMetadata extends IIOMetadata {
|
||||
boolean bounded, int min, int max)
|
||||
throws IIOInvalidTreeException {
|
||||
String value = getStringAttribute(node, name, null, required, null);
|
||||
if (value == null || "".equals(value)) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
@ -1284,7 +1284,7 @@ public class TIFFImageMetadata extends IIOMetadata {
|
||||
if(keywordNode != null) {
|
||||
String keyword = keywordNode.getNodeValue();
|
||||
String value = getAttribute(child, "value");
|
||||
if(!keyword.equals("") && !value.equals("")) {
|
||||
if (!keyword.isEmpty() && !value.isEmpty()) {
|
||||
if(keyword.equalsIgnoreCase("DocumentName")) {
|
||||
tagNumber =
|
||||
BaselineTIFFTagSet.TAG_DOCUMENT_NAME;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -1269,7 +1269,7 @@ class GTKFileChooserUI extends SynthFileChooserUI {
|
||||
super(FilePane.ACTION_EDIT_FILE_NAME);
|
||||
}
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (getFileName().equals("")) {
|
||||
if (getFileName().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
JFileChooser fc = getFileChooser();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 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
|
||||
@ -444,7 +444,7 @@ public class FileDialog extends Dialog {
|
||||
* @see java.awt.FileDialog#getDirectory
|
||||
*/
|
||||
public void setDirectory(String dir) {
|
||||
this.dir = (dir != null && dir.equals("")) ? null : dir;
|
||||
this.dir = (dir != null && dir.isEmpty()) ? null : dir;
|
||||
FileDialogPeer peer = (FileDialogPeer)this.peer;
|
||||
if (peer != null) {
|
||||
peer.setDirectory(this.dir);
|
||||
@ -524,7 +524,7 @@ public class FileDialog extends Dialog {
|
||||
* @see #getFiles
|
||||
*/
|
||||
public void setFile(String file) {
|
||||
this.file = (file != null && file.equals("")) ? null : file;
|
||||
this.file = (file != null && file.isEmpty()) ? null : file;
|
||||
FileDialogPeer peer = (FileDialogPeer)this.peer;
|
||||
if (peer != null) {
|
||||
peer.setFile(this.file);
|
||||
@ -605,10 +605,10 @@ public class FileDialog extends Dialog {
|
||||
s.defaultReadObject();
|
||||
|
||||
// 1.1 Compatibility: "" is not converted to null in 1.1
|
||||
if (dir != null && dir.equals("")) {
|
||||
if (dir != null && dir.isEmpty()) {
|
||||
dir = null;
|
||||
}
|
||||
if (file != null && file.equals("")) {
|
||||
if (file != null && file.isEmpty()) {
|
||||
file = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 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
|
||||
@ -1023,7 +1023,7 @@ public class TextComponent extends Component implements Accessible {
|
||||
public String getSelectedText() {
|
||||
String selText = TextComponent.this.getSelectedText();
|
||||
// Fix for 4256662
|
||||
if (selText == null || selText.equals("")) {
|
||||
if (selText == null || selText.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return selText;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -371,7 +371,7 @@ public class EventHandler implements InvocationHandler {
|
||||
}
|
||||
|
||||
private Object applyGetters(Object target, String getters) {
|
||||
if (getters == null || getters.equals("")) {
|
||||
if (getters == null || getters.isEmpty()) {
|
||||
return target;
|
||||
}
|
||||
int firstDot = getters.indexOf('.');
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -1420,7 +1420,7 @@ public class JEditorPane extends JTextComponent {
|
||||
try {
|
||||
Document doc = getDocument();
|
||||
doc.remove(0, doc.getLength());
|
||||
if (t == null || t.equals("")) {
|
||||
if (t == null || t.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Reader r = new StringReader(t);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -1100,7 +1100,7 @@ public class SwingUtilities implements SwingConstants
|
||||
* and use 0,0,0,0 for textR.
|
||||
*/
|
||||
|
||||
boolean textIsEmpty = (text == null) || text.equals("");
|
||||
boolean textIsEmpty = (text == null) || text.isEmpty();
|
||||
int lsb = 0;
|
||||
int rsb = 0;
|
||||
/* Unless both text and icon are non-null, we effectively ignore
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -275,7 +275,7 @@ public class BasicButtonUI extends ButtonUI{
|
||||
paintIcon(g,c,iconRect);
|
||||
}
|
||||
|
||||
if (text != null && !text.equals("")){
|
||||
if (text != null && !text.isEmpty()){
|
||||
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
|
||||
if (v != null) {
|
||||
v.paint(g, textRect);
|
||||
@ -495,7 +495,7 @@ public class BasicButtonUI extends ButtonUI{
|
||||
super.getBaseline(c, width, height);
|
||||
AbstractButton b = (AbstractButton)c;
|
||||
String text = b.getText();
|
||||
if (text == null || "".equals(text)) {
|
||||
if (text == null || text.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
FontMetrics fm = b.getFontMetrics(b.getFont());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -79,7 +79,7 @@ implements ListCellRenderer<Object>, Serializable {
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension size;
|
||||
|
||||
if ((this.getText() == null) || (this.getText().equals( "" ))) {
|
||||
if (this.getText() == null || this.getText().isEmpty()) {
|
||||
setText( " " );
|
||||
size = super.getPreferredSize();
|
||||
setText( "" );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -304,7 +304,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
|
||||
super.getBaseline(c, width, height);
|
||||
JLabel label = (JLabel)c;
|
||||
String text = label.getText();
|
||||
if (text == null || "".equals(text) || label.getFont() == null) {
|
||||
if (text == null || text.isEmpty() || label.getFont() == null) {
|
||||
return -1;
|
||||
}
|
||||
FontMetrics fm = label.getFontMetrics(label.getFont());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -716,7 +716,7 @@ public class BasicMenuItemUI extends MenuItemUI
|
||||
|
||||
private void paintAccText(Graphics g, MenuItemLayoutHelper lh,
|
||||
MenuItemLayoutHelper.LayoutResult lr) {
|
||||
if (!lh.getAccText().equals("")) {
|
||||
if (!lh.getAccText().isEmpty()) {
|
||||
ButtonModel model = lh.getMenuItem().getModel();
|
||||
g.setFont(lh.getAccFontMetrics().getFont());
|
||||
if (!model.isEnabled()) {
|
||||
@ -754,7 +754,7 @@ public class BasicMenuItemUI extends MenuItemUI
|
||||
|
||||
private void paintText(Graphics g, MenuItemLayoutHelper lh,
|
||||
MenuItemLayoutHelper.LayoutResult lr) {
|
||||
if (!lh.getText().equals("")) {
|
||||
if (!lh.getText().isEmpty()) {
|
||||
if (lh.getHtmlView() != null) {
|
||||
// Text is HTML
|
||||
lh.getHtmlView().paint(g, lr.getTextRect());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -119,7 +119,7 @@ public class BasicToggleButtonUI extends BasicButtonUI {
|
||||
}
|
||||
|
||||
// Draw the Text
|
||||
if(text != null && !text.equals("")) {
|
||||
if (text != null && !text.isEmpty()) {
|
||||
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
|
||||
if (v != null) {
|
||||
v.paint(g, textRect);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -187,7 +187,7 @@ public class BasicToolTipUI extends ToolTipUI
|
||||
insets.top+insets.bottom);
|
||||
String text = ((JToolTip)c).getTipText();
|
||||
|
||||
if ((text == null) || text.equals("")) {
|
||||
if (text == null) {
|
||||
text = "";
|
||||
}
|
||||
else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -202,7 +202,7 @@ public class MetalButtonUI extends BasicButtonUI {
|
||||
boolean isIcon = b.getIcon() != null;
|
||||
|
||||
// If there is text
|
||||
if ( text != null && !text.equals( "" ) ) {
|
||||
if ( text != null && !text.isEmpty()) {
|
||||
if ( !isIcon ) {
|
||||
focusRect.setBounds( textRect );
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -224,7 +224,7 @@ public class MetalToggleButtonUI extends BasicToggleButtonUI {
|
||||
boolean isIcon = b.getIcon() != null;
|
||||
|
||||
// If there is text
|
||||
if ( text != null && !text.equals( "" ) ) {
|
||||
if ( text != null && !text.isEmpty()) {
|
||||
if ( !isIcon ) {
|
||||
focusRect.setBounds( textRect );
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -132,7 +132,7 @@ public class MetalToolTipUI extends BasicToolTipUI {
|
||||
accelBL = metrics.getAscent();
|
||||
}
|
||||
|
||||
if (!accelString.equals("")) {
|
||||
if (!accelString.isEmpty()) {
|
||||
g.setFont(smallFont);
|
||||
g.setColor( MetalLookAndFeel.getPrimaryControlDarkShadow() );
|
||||
SwingUtilities2.drawString(tip, g, accelString,
|
||||
@ -145,7 +145,7 @@ public class MetalToolTipUI extends BasicToolTipUI {
|
||||
}
|
||||
|
||||
private int calcAccelSpacing(JComponent c, FontMetrics fm, String accel) {
|
||||
return accel.equals("")
|
||||
return accel.isEmpty()
|
||||
? 0
|
||||
: padSpaceBetweenStrings +
|
||||
SwingUtilities2.stringWidth(c, fm, accel);
|
||||
@ -155,7 +155,7 @@ public class MetalToolTipUI extends BasicToolTipUI {
|
||||
Dimension d = super.getPreferredSize(c);
|
||||
|
||||
String key = getAcceleratorString((JToolTip)c);
|
||||
if (!(key.equals(""))) {
|
||||
if (!key.isEmpty()) {
|
||||
d.width += calcAccelSpacing(c, c.getFontMetrics(smallFont), key);
|
||||
}
|
||||
return d;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -195,7 +195,7 @@ public class SynthButtonUI extends BasicButtonUI implements
|
||||
}
|
||||
AbstractButton b = (AbstractButton)c;
|
||||
String text = b.getText();
|
||||
if (text == null || "".equals(text)) {
|
||||
if (text == null || text.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
Insets i = b.getInsets();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -638,7 +638,7 @@ public class SynthGraphicsUtils {
|
||||
static void paintAccText(Graphics g, SynthMenuItemLayoutHelper lh,
|
||||
MenuItemLayoutHelper.LayoutResult lr) {
|
||||
String accText = lh.getAccText();
|
||||
if (accText != null && !accText.equals("")) {
|
||||
if (accText != null && !accText.isEmpty()) {
|
||||
g.setColor(lh.getAccStyle().getColor(lh.getAccContext(),
|
||||
ColorType.TEXT_FOREGROUND));
|
||||
g.setFont(lh.getAccStyle().getFont(lh.getAccContext()));
|
||||
@ -649,7 +649,7 @@ public class SynthGraphicsUtils {
|
||||
|
||||
static void paintText(Graphics g, SynthMenuItemLayoutHelper lh,
|
||||
MenuItemLayoutHelper.LayoutResult lr) {
|
||||
if (!lh.getText().equals("")) {
|
||||
if (!lh.getText().isEmpty()) {
|
||||
if (lh.getHtmlView() != null) {
|
||||
// Text is HTML
|
||||
lh.getHtmlView().paint(g, lr.getTextRect());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -115,7 +115,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI {
|
||||
}
|
||||
JLabel label = (JLabel)c;
|
||||
String text = label.getText();
|
||||
if (text == null || "".equals(text)) {
|
||||
if (text == null || text.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
Insets i = label.getInsets();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -134,7 +134,7 @@ class SynthMenuItemLayoutHelper extends MenuItemLayoutHelper {
|
||||
}
|
||||
|
||||
// accRect
|
||||
if (!getAccText().equals("")) {
|
||||
if (!getAccText().isEmpty()) {
|
||||
getAccSize().setWidth(accGu.computeStringWidth(getAccContext(),
|
||||
getAccFontMetrics().getFont(), getAccFontMetrics(),
|
||||
getAccText()));
|
||||
@ -144,7 +144,7 @@ class SynthMenuItemLayoutHelper extends MenuItemLayoutHelper {
|
||||
// textRect
|
||||
if (getText() == null) {
|
||||
setText("");
|
||||
} else if (!getText().equals("")) {
|
||||
} else if (!getText().isEmpty()) {
|
||||
if (getHtmlView() != null) {
|
||||
// Text is HTML
|
||||
getTextSize().setWidth(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -602,7 +602,7 @@ public class FormView extends ComponentView implements ActionListener {
|
||||
String name = (String) getElement().getAttributes().getAttribute(HTML.Attribute.NAME);
|
||||
|
||||
String data;
|
||||
if (name == null || name.equals("")) {
|
||||
if (name == null || name.isEmpty()) {
|
||||
data = "x="+ x +"&y="+ y;
|
||||
} else {
|
||||
name = URLEncoder.encode(name);
|
||||
|
||||
@ -69,7 +69,7 @@ class FrameView extends ComponentView implements HyperlinkListener {
|
||||
AttributeSet attributes = elem.getAttributes();
|
||||
String srcAtt = (String)attributes.getAttribute(HTML.Attribute.SRC);
|
||||
|
||||
if ((srcAtt != null) && (!srcAtt.equals(""))) {
|
||||
if (srcAtt != null && !srcAtt.isEmpty()) {
|
||||
try {
|
||||
URL base = ((HTMLDocument)elem.getDocument()).getBase();
|
||||
src = new URL(base, srcAtt);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -939,10 +939,10 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
|
||||
} else {
|
||||
String target = (anchor != null) ?
|
||||
(String)anchor.getAttribute(HTML.Attribute.TARGET) : null;
|
||||
if ((target == null) || (target.equals(""))) {
|
||||
if (target == null || target.isEmpty()) {
|
||||
target = hdoc.getBaseTarget();
|
||||
}
|
||||
if ((target == null) || (target.equals(""))) {
|
||||
if (target == null || target.isEmpty()) {
|
||||
target = "_self";
|
||||
}
|
||||
linkEvent = new HTMLFrameHyperlinkEvent(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -162,7 +162,7 @@ public final class DebugSettings {
|
||||
|
||||
// check if the user specified a particular settings file
|
||||
propPath = System.getProperty(PREFIX + "." + PROP_FILE, "");
|
||||
if (propPath.equals("")) {
|
||||
if (propPath.isEmpty()) {
|
||||
// otherwise get it from the user's home directory
|
||||
propPath = System.getProperty("user.home", "") +
|
||||
File.separator +
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -569,9 +569,9 @@ class ExecutableInputMethodManager extends InputMethodManager
|
||||
String country = locale.getCountry();
|
||||
String variant = locale.getVariant();
|
||||
String localePath = null;
|
||||
if (!variant.equals("")) {
|
||||
if (!variant.isEmpty()) {
|
||||
localePath = "_" + language + "/_" + country + "/_" + variant;
|
||||
} else if (!country.equals("")) {
|
||||
} else if (!country.isEmpty()) {
|
||||
localePath = "_" + language + "/_" + country;
|
||||
} else {
|
||||
localePath = "_" + language;
|
||||
|
||||
@ -773,7 +773,7 @@ public class InputContext extends java.awt.im.InputContext
|
||||
getStartupLocale());
|
||||
}
|
||||
|
||||
if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
|
||||
if (inputMethodInfo != null && !inputMethodInfo.isEmpty()) {
|
||||
return inputMethodInfo;
|
||||
}
|
||||
|
||||
|
||||
@ -645,7 +645,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
|
||||
String fontName = f.fullName;
|
||||
String familyName = f.familyName;
|
||||
if (fontName == null || "".equals(fontName)) {
|
||||
if (fontName == null || fontName.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (compositeFonts.containsKey(fontName)) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -1594,15 +1594,15 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
int ncomps = 2; // minimum number of print args
|
||||
int n = 0;
|
||||
|
||||
if (printer != null && !printer.equals("") && !printer.equals("lp")) {
|
||||
if (printer != null && !printer.isEmpty() && !printer.equals("lp")) {
|
||||
pFlags |= PRINTER;
|
||||
ncomps+=1;
|
||||
}
|
||||
if (options != null && !options.equals("")) {
|
||||
if (options != null && !options.isEmpty()) {
|
||||
pFlags |= OPTIONS;
|
||||
ncomps+=1;
|
||||
}
|
||||
if (jobTitle != null && !jobTitle.equals("")) {
|
||||
if (jobTitle != null && !jobTitle.isEmpty()) {
|
||||
pFlags |= JOBTITLE;
|
||||
ncomps+=1;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -451,7 +451,7 @@ public class PSStreamPrintJob implements CancelablePrintJob {
|
||||
} catch (SecurityException se) {
|
||||
}
|
||||
|
||||
if (userName == null || userName.equals("")) {
|
||||
if (userName == null || userName.isEmpty()) {
|
||||
RequestingUserName ruName =
|
||||
(RequestingUserName)reqSet.get(RequestingUserName.class);
|
||||
if (ruName != null) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -212,7 +212,7 @@ public class PSStreamPrintService extends StreamPrintService
|
||||
} else if (category == Media.class) {
|
||||
String defaultCountry = Locale.getDefault().getCountry();
|
||||
if (defaultCountry != null &&
|
||||
(defaultCountry.equals("") ||
|
||||
(defaultCountry.isEmpty() ||
|
||||
defaultCountry.equals(Locale.US.getCountry()) ||
|
||||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
|
||||
return MediaSizeName.NA_LETTER;
|
||||
@ -224,7 +224,7 @@ public class PSStreamPrintService extends StreamPrintService
|
||||
float iw, ih;
|
||||
float margin = 0.5f; // both these papers > 5" in all dimensions
|
||||
if (defaultCountry != null &&
|
||||
(defaultCountry.equals("") ||
|
||||
(defaultCountry.isEmpty() ||
|
||||
defaultCountry.equals(Locale.US.getCountry()) ||
|
||||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
|
||||
iw = MediaSize.NA.LETTER.getX(Size2DSyntax.INCH) - 2*margin;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -683,7 +683,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable {
|
||||
URI uri = null;
|
||||
try {
|
||||
if (fileName != null) {
|
||||
if (fileName.equals("")) {
|
||||
if (fileName.isEmpty()) {
|
||||
fileName = ".";
|
||||
}
|
||||
} else {
|
||||
@ -1233,11 +1233,11 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable {
|
||||
(jobAttributes.getDestination() == DestinationType.PRINTER) ?
|
||||
PRINTER : FILE);
|
||||
str = jobAttributes.getPrinter();
|
||||
if (str != null && !str.equals("")) {
|
||||
if (str != null && !str.isEmpty()) {
|
||||
props.setProperty(PRINTER_PROP, str);
|
||||
}
|
||||
str = jobAttributes.getFileName();
|
||||
if (str != null && !str.equals("")) {
|
||||
if (str != null && !str.isEmpty()) {
|
||||
props.setProperty(FILENAME_PROP, str);
|
||||
}
|
||||
int copies = jobAttributes.getCopies();
|
||||
@ -1245,7 +1245,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable {
|
||||
props.setProperty(NUMCOPIES_PROP, "" + copies);
|
||||
}
|
||||
str = this.options;
|
||||
if (str != null && !str.equals("")) {
|
||||
if (str != null && !str.isEmpty()) {
|
||||
props.setProperty(OPTIONS_PROP, str);
|
||||
}
|
||||
props.setProperty(ORIENT_PROP,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -1395,7 +1395,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
|
||||
String unitsKey = "label.millimetres";
|
||||
String defaultCountry = Locale.getDefault().getCountry();
|
||||
if (defaultCountry != null &&
|
||||
(defaultCountry.equals("") ||
|
||||
(defaultCountry.isEmpty() ||
|
||||
defaultCountry.equals(Locale.US.getCountry()) ||
|
||||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
|
||||
unitsKey = "label.inches";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -256,7 +256,7 @@ public class MenuItemLayoutHelper {
|
||||
}
|
||||
|
||||
// accRect
|
||||
if (!accText.equals("")) {
|
||||
if (!accText.isEmpty()) {
|
||||
accSize.width = SwingUtilities2.stringWidth(mi, accFm, accText);
|
||||
accSize.height = accFm.getHeight();
|
||||
}
|
||||
@ -264,7 +264,7 @@ public class MenuItemLayoutHelper {
|
||||
// textRect
|
||||
if (text == null) {
|
||||
text = "";
|
||||
} else if (!text.equals("")) {
|
||||
} else if (!text.isEmpty()) {
|
||||
if (htmlView != null) {
|
||||
// Text is HTML
|
||||
textSize.width =
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -382,7 +382,7 @@ public class SwingUtilities2 {
|
||||
*/
|
||||
public static float stringWidth(JComponent c, FontMetrics fm, String string,
|
||||
boolean useFPAPI){
|
||||
if (string == null || string.equals("")) {
|
||||
if (string == null || string.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
boolean needsTextLayout = ((c != null) &&
|
||||
@ -415,7 +415,7 @@ public class SwingUtilities2 {
|
||||
public static String clipStringIfNecessary(JComponent c, FontMetrics fm,
|
||||
String string,
|
||||
int availTextWidth) {
|
||||
if ((string == null) || (string.equals(""))) {
|
||||
if (string == null || string.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
int textWidth = SwingUtilities2.stringWidth(c, fm, string);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -321,7 +321,7 @@ public abstract class SynthFileChooserUI extends BasicFileChooserUI implements
|
||||
|
||||
resetGlobFilter();
|
||||
|
||||
if (fileName == null || fileName.equals("") ||
|
||||
if (fileName == null || fileName.isEmpty() ||
|
||||
(chooser.isMultiSelectionEnabled() && fileName.startsWith("\""))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -208,7 +208,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
}
|
||||
|
||||
protected String getWMName() {
|
||||
if (winAttr.title == null || winAttr.title.trim().equals("")) {
|
||||
if (winAttr.title == null || winAttr.title.trim().isEmpty()) {
|
||||
return " ";
|
||||
} else {
|
||||
return winAttr.title;
|
||||
@ -220,7 +220,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
try {
|
||||
super.updateWMName();
|
||||
String name = getWMName();
|
||||
if (name == null || name.trim().equals("")) {
|
||||
if (name == null || name.trim().isEmpty()) {
|
||||
name = "Java";
|
||||
}
|
||||
XAtom iconNameAtom = XAtom.get(XAtom.XA_WM_ICON_NAME);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -461,7 +461,7 @@ class XFileDialogPeer extends XDialogPeer
|
||||
// Here we restoring Motif behaviour
|
||||
setSelectionField(target.getFile());
|
||||
|
||||
if (f.equals("")) {
|
||||
if (f.isEmpty()) {
|
||||
f = "*";
|
||||
setFilterField(f);
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -233,7 +233,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
||||
*/
|
||||
protected Dimension getCaptionSize() {
|
||||
String s = getTargetLabel();
|
||||
if (s.equals("")) {
|
||||
if (s.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Graphics g = getGraphics();
|
||||
@ -260,7 +260,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
||||
*/
|
||||
protected void paintCaption(Graphics g, Rectangle rect) {
|
||||
String s = getTargetLabel();
|
||||
if (s.equals("")) {
|
||||
if (s.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
g.setFont(getTargetFont());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -423,7 +423,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
if (bottom >= 0) {
|
||||
mainClassName = trace[bottom].getClassName();
|
||||
}
|
||||
if (mainClassName == null || mainClassName.equals("")) {
|
||||
if (mainClassName == null || mainClassName.isEmpty()) {
|
||||
mainClassName = "AWT";
|
||||
}
|
||||
awtAppClassName = getCorrectXIDString(mainClassName);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -208,7 +208,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
protected String getWMName() {
|
||||
String name = target.getName();
|
||||
if (name == null || name.trim().equals("")) {
|
||||
if (name == null || name.trim().isEmpty()) {
|
||||
name = " ";
|
||||
}
|
||||
return name;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -511,7 +511,7 @@ public abstract class X11InputMethodBase extends InputMethodAdapter {
|
||||
flush += composedText.toString();
|
||||
}
|
||||
|
||||
if (!flush.equals("")) {
|
||||
if (!flush.isEmpty()) {
|
||||
AttributedString attrstr = new AttributedString(flush);
|
||||
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
|
||||
attrstr.getIterator(),
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -143,7 +143,7 @@ public class FontConfigManager {
|
||||
Locale l = SunToolkit.getStartupLocale();
|
||||
String localeStr = l.getLanguage();
|
||||
String country = l.getCountry();
|
||||
if (!country.equals("")) {
|
||||
if (!country.isEmpty()) {
|
||||
localeStr = localeStr + "-" + country;
|
||||
}
|
||||
return localeStr;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -1346,7 +1346,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE)) {
|
||||
URI uri = ((Destination)attr).getURI();
|
||||
if ("file".equals(uri.getScheme()) &&
|
||||
!(uri.getSchemeSpecificPart().equals(""))) {
|
||||
!uri.getSchemeSpecificPart().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1503,7 +1503,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
||||
if (mediaSizeNames.length == 0) {
|
||||
String defaultCountry = Locale.getDefault().getCountry();
|
||||
if (defaultCountry != null &&
|
||||
(defaultCountry.equals("") ||
|
||||
(defaultCountry.isEmpty() ||
|
||||
defaultCountry.equals(Locale.US.getCountry()) ||
|
||||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
|
||||
return MediaSizeName.NA_LETTER;
|
||||
@ -1540,7 +1540,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
||||
String defaultCountry = Locale.getDefault().getCountry();
|
||||
float iw, ih;
|
||||
if (defaultCountry != null &&
|
||||
(defaultCountry.equals("") ||
|
||||
(defaultCountry.isEmpty() ||
|
||||
defaultCountry.equals(Locale.US.getCountry()) ||
|
||||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
|
||||
iw = MediaSize.NA.LETTER.getX(Size2DSyntax.INCH) - 0.5f;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -457,7 +457,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
|
||||
*/
|
||||
private PrintService getServiceByName(PrinterName nameAttr) {
|
||||
String name = nameAttr.getValue();
|
||||
if (name == null || name.equals("") || !checkPrinterName(name)) {
|
||||
if (name == null || name.isEmpty() || !checkPrinterName(name)) {
|
||||
return null;
|
||||
}
|
||||
/* check if all printers are already available */
|
||||
@ -823,7 +823,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
|
||||
for (int i=0; i < names.length; i++) {
|
||||
if (!names[i].equals("_default") &&
|
||||
!names[i].equals(defaultPrinter) &&
|
||||
!names[i].equals("")) {
|
||||
!names[i].isEmpty()) {
|
||||
printerNames.add(names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -394,7 +394,7 @@ public class UnixPrintJob implements CancelablePrintJob {
|
||||
String repClassName = flavor.getRepresentationClassName();
|
||||
String val = flavor.getParameter("charset");
|
||||
String encoding = "us-ascii";
|
||||
if (val != null && !val.equals("")) {
|
||||
if (val != null && !val.isEmpty()) {
|
||||
encoding = val;
|
||||
}
|
||||
|
||||
@ -733,7 +733,7 @@ public class UnixPrintJob implements CancelablePrintJob {
|
||||
} catch (SecurityException se) {
|
||||
}
|
||||
|
||||
if (userName == null || userName.equals("")) {
|
||||
if (userName == null || userName.isEmpty()) {
|
||||
RequestingUserName ruName =
|
||||
(RequestingUserName)reqSet.get(RequestingUserName.class);
|
||||
if (ruName != null) {
|
||||
@ -865,15 +865,15 @@ public class UnixPrintJob implements CancelablePrintJob {
|
||||
int n = 0;
|
||||
|
||||
// conveniently "lp" is the default destination for both lp and lpr.
|
||||
if (printer != null && !printer.equals("") && !printer.equals("lp")) {
|
||||
if (printer != null && !printer.isEmpty() && !printer.equals("lp")) {
|
||||
pFlags |= PRINTER;
|
||||
ncomps+=1;
|
||||
}
|
||||
if (options != null && !options.equals("")) {
|
||||
if (options != null && !options.isEmpty()) {
|
||||
pFlags |= OPTIONS;
|
||||
ncomps+=1;
|
||||
}
|
||||
if (jobTitle != null && !jobTitle.equals("")) {
|
||||
if (jobTitle != null && !jobTitle.isEmpty()) {
|
||||
pFlags |= JOBTITLE;
|
||||
ncomps+=1;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -289,7 +289,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
|
||||
// Remove the header lines
|
||||
if (posPrinters[i].startsWith("---") ||
|
||||
posPrinters[i].startsWith("Queue") ||
|
||||
posPrinters[i].equals("")) continue;
|
||||
posPrinters[i].isEmpty()) continue;
|
||||
|
||||
// Check if there is a ":" in the end of the first colomn.
|
||||
// This means that it is not a valid printer definition.
|
||||
@ -694,7 +694,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
|
||||
} else if (category == Media.class) {
|
||||
String defaultCountry = Locale.getDefault().getCountry();
|
||||
if (defaultCountry != null &&
|
||||
(defaultCountry.equals("") ||
|
||||
(defaultCountry.isEmpty() ||
|
||||
defaultCountry.equals(Locale.US.getCountry()) ||
|
||||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
|
||||
return MediaSizeName.NA_LETTER;
|
||||
@ -705,7 +705,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
|
||||
String defaultCountry = Locale.getDefault().getCountry();
|
||||
float iw, ih;
|
||||
if (defaultCountry != null &&
|
||||
(defaultCountry.equals("") ||
|
||||
(defaultCountry.isEmpty() ||
|
||||
defaultCountry.equals(Locale.US.getCountry()) ||
|
||||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
|
||||
iw = MediaSize.NA.LETTER.getX(Size2DSyntax.INCH) - 0.5f;
|
||||
@ -997,7 +997,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
|
||||
} else if (attr.getCategory() == Destination.class) {
|
||||
URI uri = ((Destination)attr).getURI();
|
||||
if ("file".equals(uri.getScheme()) &&
|
||||
!(uri.getSchemeSpecificPart().equals(""))) {
|
||||
!uri.getSchemeSpecificPart().isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -134,8 +134,8 @@ public class WindowsFlags {
|
||||
propString.equals("t") ||
|
||||
propString.equals("True") ||
|
||||
propString.equals("T") ||
|
||||
propString.equals("")) // having the prop name alone
|
||||
{ // is equivalent to true
|
||||
propString.isEmpty()) // having the prop name alone
|
||||
{ // is equivalent to true
|
||||
returnVal = true;
|
||||
} else if (propString.equals("false") ||
|
||||
propString.equals("f") ||
|
||||
|
||||
@ -207,7 +207,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup {
|
||||
|
||||
public synchronized PrintService getPrintServiceByName(String name) {
|
||||
|
||||
if (name == null || name.equals("")) {
|
||||
if (name == null || name.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
/* getPrintServices() is now very fast. */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -622,7 +622,7 @@ public class Win32PrintJob implements CancelablePrintJob {
|
||||
} catch (SecurityException se) {
|
||||
}
|
||||
|
||||
if (userName == null || userName.equals("")) {
|
||||
if (userName == null || userName.isEmpty()) {
|
||||
RequestingUserName ruName =
|
||||
(RequestingUserName)reqSet.get(RequestingUserName.class);
|
||||
if (ruName != null) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -1536,7 +1536,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
|
||||
} else if (category == Destination.class) {
|
||||
URI uri = ((Destination)attr).getURI();
|
||||
if ("file".equals(uri.getScheme()) &&
|
||||
!(uri.getSchemeSpecificPart().equals(""))) {
|
||||
!uri.getSchemeSpecificPart().isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user