src/share/classes/sun/swing/SwingUtilities2.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -125,11 +125,11 @@
/* Presently this class assumes default fractional metrics.
* This may need to change to emulate future platform L&Fs.
*/
public static class AATextInfo {
- private static AATextInfo getAATextInfoFromMap(Map hints) {
+ private static AATextInfo getAATextInfoFromMap(Map<java.awt.RenderingHints.Key, Object> hints) {
Object aaHint = hints.get(KEY_TEXT_ANTIALIASING);
Object contHint = hints.get(KEY_TEXT_LCD_CONTRAST);
if (aaHint == null ||
@@ -139,16 +139,17 @@
} else {
return new AATextInfo(aaHint, (Integer)contHint);
}
}
+ @SuppressWarnings("unchecked")
public static AATextInfo getAATextInfo(boolean lafCondition) {
SunToolkit.setAAFontSettingsCondition(lafCondition);
Toolkit tk = Toolkit.getDefaultToolkit();
Object map = tk.getDesktopProperty(SunToolkit.DESKTOPFONTHINTS);
if (map instanceof Map) {
- return getAATextInfoFromMap((Map)map);
+ return getAATextInfoFromMap((Map<java.awt.RenderingHints.Key, Object>)map);
} else {
return null;
}
}
@@ -661,11 +662,11 @@
* Point is within the actual bounds of a list item (not just in the cell)
* and if the JList has the "List.isFileList" client property set.
* Otherwise, this method returns -1.
* This is used to make WindowsL&F JFileChooser act like native dialogs.
*/
- public static int loc2IndexFileList(JList list, Point point) {
+ public static int loc2IndexFileList(JList<?> list, Point point) {
int index = list.locationToIndex(point);
if (index != -1) {
Object bySize = list.getClientProperty("List.isFileList");
if (bySize instanceof Boolean && ((Boolean)bySize).booleanValue() &&
!pointIsInActualBounds(list, index, point)) {
@@ -678,15 +679,14 @@
/**
* Returns true if the given point is within the actual bounds of the
* JList item at index (not just inside the cell).
*/
- private static boolean pointIsInActualBounds(JList list, int index,
+ private static <T> boolean pointIsInActualBounds(JList<T> list, int index,
Point point) {
- ListCellRenderer renderer = list.getCellRenderer();
- ListModel dataModel = list.getModel();
- Object value = dataModel.getElementAt(index);
+ ListCellRenderer<? super T> renderer = list.getCellRenderer();
+ T value = list.getModel().getElementAt(index);
Component item = renderer.getListCellRendererComponent(list,
value, index, false, false);
Dimension itemSize = item.getPreferredSize();
Rectangle cellBounds = list.getCellBounds(index, index);
if (!item.getComponentOrientation().isLeftToRight()) {