< prev index next >
src/share/classes/javax/swing/JLayeredPane.java
Print this page
rev 1527 : 6727662: Code improvement and warnings removing from swing packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: malenkov
*** 189,199 ****
}
private void validateOptimizedDrawing() {
boolean layeredComponentFound = false;
synchronized(getTreeLock()) {
! Integer layer = null;
for (Component c : getComponents()) {
layer = null;
if(c instanceof JInternalFrame || (c instanceof JComponent &&
(layer = (Integer)((JComponent)c).getClientProperty(
--- 189,199 ----
}
private void validateOptimizedDrawing() {
boolean layeredComponentFound = false;
synchronized(getTreeLock()) {
! Integer layer;
for (Component c : getComponents()) {
layer = null;
if(c instanceof JInternalFrame || (c instanceof JComponent &&
(layer = (Integer)((JComponent)c).getClientProperty(
*** 211,221 ****
else
optimizedDrawingPossible = true;
}
protected void addImpl(Component comp, Object constraints, int index) {
! int layer = DEFAULT_LAYER.intValue();
int pos;
if(constraints instanceof Integer) {
layer = ((Integer)constraints).intValue();
setLayer(comp, layer);
--- 211,221 ----
else
optimizedDrawingPossible = true;
}
protected void addImpl(Component comp, Object constraints, int index) {
! int layer;
int pos;
if(constraints instanceof Integer) {
layer = ((Integer)constraints).intValue();
setLayer(comp, layer);
*** 362,372 ****
/// MAKE SURE THIS AND putLayer(JComponent c, int layer) are SYNCED
if(c instanceof JComponent)
((JComponent)c).putClientProperty(LAYER_PROPERTY, layerObj);
else
! getComponentToLayer().put((Component)c, layerObj);
if(c.getParent() == null || c.getParent() != this) {
repaint(c.getBounds());
return;
}
--- 362,372 ----
/// MAKE SURE THIS AND putLayer(JComponent c, int layer) are SYNCED
if(c instanceof JComponent)
((JComponent)c).putClientProperty(LAYER_PROPERTY, layerObj);
else
! getComponentToLayer().put(c, layerObj);
if(c.getParent() == null || c.getParent() != this) {
repaint(c.getBounds());
return;
}
*** 386,396 ****
public int getLayer(Component c) {
Integer i;
if(c instanceof JComponent)
i = (Integer)((JComponent)c).getClientProperty(LAYER_PROPERTY);
else
! i = (Integer)getComponentToLayer().get((Component)c);
if(i == null)
return DEFAULT_LAYER.intValue();
return i.intValue();
}
--- 386,396 ----
public int getLayer(Component c) {
Integer i;
if(c instanceof JComponent)
i = (Integer)((JComponent)c).getClientProperty(LAYER_PROPERTY);
else
! i = getComponentToLayer().get(c);
if(i == null)
return DEFAULT_LAYER.intValue();
return i.intValue();
}
*** 463,475 ****
* count of components at that layer, minus 1
*
* @see #getComponentCountInLayer
*/
public int getPosition(Component c) {
! int i, count, startLayer, curLayer, startLocation, pos = 0;
! count = getComponentCount();
startLocation = getIndexOf(c);
if(startLocation == -1)
return -1;
--- 463,475 ----
* count of components at that layer, minus 1
*
* @see #getComponentCountInLayer
*/
public int getPosition(Component c) {
! int i, startLayer, curLayer, startLocation, pos = 0;
! getComponentCount();
startLocation = getIndexOf(c);
if(startLocation == -1)
return -1;
< prev index next >