8277868: Use Comparable.compare() instead of surrogate code

Reviewed-by: rriggs, aivanov
This commit is contained in:
Sergey Tsypanov 2021-12-16 21:39:08 +00:00 committed by Roger Riggs
parent 937126b140
commit 20db7800a6
12 changed files with 23 additions and 75 deletions

View file

@ -27,16 +27,11 @@ package javax.swing.plaf.basic;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.dnd.*;
import java.awt.event.*;
import java.util.Enumeration;
import java.util.EventObject;
import java.util.Hashtable;
import java.util.TooManyListenersException;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.text.*;
import javax.swing.table.*;
import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag;
import sun.swing.SwingUtilities2;
@ -221,8 +216,8 @@ public class BasicTableUI extends TableUI
this.inSelection = true;
// look at the sign of dx and dy only
dx = sign(dx);
dy = sign(dy);
dx = Integer.signum(dx);
dy = Integer.signum(dy);
// make sure one is zero, but not both
assert (dx == 0 || dy == 0) && !(dx == 0 && dy == 0);
@ -250,10 +245,6 @@ public class BasicTableUI extends TableUI
leadColumn = clipToRange(leadColumn+dx, 0, table.getColumnCount());
}
private static int sign(int num) {
return (num < 0) ? -1 : ((num == 0) ? 0 : 1);
}
/**
* Called to move within the selected range of the given JTable.
* This method uses the table's notion of selection, which is