You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/11/27 04:46:24 UTC
svn commit: r479507 [2/2] -
/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java?view=diff&rev=479507&r1=479506&r2=479507
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java Sun Nov 26 19:46:23 2006
@@ -14,12 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/**
- * @author Vadim L. Bogdanov
- * @version $Revision$
- */
-
package javax.swing;
import java.awt.AWTEvent;
@@ -32,7 +26,6 @@
import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.beans.PropertyVetoException;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -41,18 +34,28 @@
import javax.swing.event.InternalFrameListener;
import javax.swing.plaf.DesktopIconUI;
import javax.swing.plaf.InternalFrameUI;
-
import org.apache.harmony.x.swing.BlitSupport;
import org.apache.harmony.x.swing.StringConstants;
-
-public class JInternalFrame extends JComponent
- implements Accessible, WindowConstants, RootPaneContainer {
+/**
+ * <p>
+ * <i>JInternalFrame</i>
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as a guarantee of serialization compatibility.</li>
+ * </ul>
+ */
+public class JInternalFrame extends JComponent implements Accessible, WindowConstants,
+ RootPaneContainer {
+ private static final long serialVersionUID = 3837984427982803247L;
/**
* This class represents the internal frame when it is iconified.
*/
public static class JDesktopIcon extends JComponent implements Accessible {
+ private static final long serialVersionUID = -4923863980546870453L;
// The internal frame for this icon.
private JInternalFrame internalFrame;
@@ -73,18 +76,21 @@
* This class implements accessibility support for
* <code>JDesktopIcon</code>.
*/
- protected class AccessibleJDesktopIcon extends AccessibleJComponent
- implements AccessibleValue {
+ protected class AccessibleJDesktopIcon extends AccessibleJComponent implements
+ AccessibleValue {
+ private static final long serialVersionUID = -7418555324455474398L;
private Number currentAccessibleValue = new Integer(0);
protected AccessibleJDesktopIcon() {
}
+ @Override
public AccessibleRole getAccessibleRole() {
return AccessibleRole.DESKTOP_ICON;
}
+ @Override
public AccessibleValue getAccessibleValue() {
return this;
}
@@ -97,9 +103,8 @@
if (n == null) {
return false;
}
-
if (n instanceof Integer) {
- currentAccessibleValue = (Integer)n;
+ currentAccessibleValue = n;
} else {
// XXX: 1.5 migration: replace this line with the commented line
currentAccessibleValue = new Integer(n.intValue());
@@ -133,7 +138,7 @@
* @return UI object for this component
*/
public DesktopIconUI getUI() {
- return (DesktopIconUI)ui;
+ return (DesktopIconUI) ui;
}
/**
@@ -164,8 +169,7 @@
// this.getInternalFrame().getDesktopIcon() != this;
// so, we cannot write here just
// return getInternalFrame().getDesktopPane();
- Container result = SwingUtilities.getAncestorOfClass(
- JDesktopPane.class, this);
+ Container result = SwingUtilities.getAncestorOfClass(JDesktopPane.class, this);
if (result == null) {
return getInternalFrame().getDesktopPane();
}
@@ -177,11 +181,11 @@
*
* @return the accessible context for the icon
*/
+ @Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJDesktopIcon();
}
-
return accessibleContext;
}
@@ -190,6 +194,7 @@
*
* @return the string "DesktopIconUI"
*/
+ @Override
public String getUIClassID() {
return "DesktopIconUI";
}
@@ -198,13 +203,14 @@
* Updates <code>UI's</code> for both <code>JInternalFrame</code>
* and <code>JDesktopIcon</code>.
*/
+ @Override
public void updateUI() {
updateUIForIcon();
getInternalFrame().updateUIForFrame();
}
void updateUIForIcon() {
- setUI((DesktopIconUI)UIManager.getUI(this));
+ setUI((DesktopIconUI) UIManager.getUI(this));
}
}
@@ -268,8 +274,8 @@
public static final String IS_ICON_PROPERTY = "icon";
private static final Integer MIN_VALUE = new Integer(Integer.MIN_VALUE);
- private static final Integer MAX_VALUE = new Integer(Integer.MAX_VALUE);
+ private static final Integer MAX_VALUE = new Integer(Integer.MAX_VALUE);
/**
* <code>JRootPane</code> containter of the internal frame.
@@ -384,8 +390,7 @@
* @param resizable
* @param closable
*/
- public JInternalFrame(final String title, final boolean resizable,
- final boolean closable) {
+ public JInternalFrame(final String title, final boolean resizable, final boolean closable) {
this(title, resizable, closable, false, false);
}
@@ -398,9 +403,8 @@
* @param closable
* @param maximizable
*/
- public JInternalFrame(final String title, final boolean resizable,
- final boolean closable,
- final boolean maximizable) {
+ public JInternalFrame(final String title, final boolean resizable, final boolean closable,
+ final boolean maximizable) {
this(title, resizable, closable, maximizable, false);
}
@@ -414,9 +418,8 @@
* @param maximizable
* @param iconifiable
*/
- public JInternalFrame(final String title, final boolean resizable,
- final boolean closable, final boolean maximizable,
- final boolean iconifiable) {
+ public JInternalFrame(final String title, final boolean resizable, final boolean closable,
+ final boolean maximizable, final boolean iconifiable) {
//super.hide();
super.setVisible(false);
this.title = title;
@@ -424,37 +427,25 @@
this.closable = closable;
this.maximizable = maximizable;
this.iconable = iconifiable;
-
// from frameInit()
setRootPane(createRootPane());
-
setLocale(JComponent.getDefaultLocale());
-
// check isDefaultLookAndFeelDecorated()
//if (isDefaultLookAndFeelDecorated()) {
// setUndecorated(true);
- //getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
- // }
-
+ //getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
+ // }
setBackground(getContentPane().getBackground());
-
// enable events
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
enableEvents(AWTEvent.KEY_EVENT_MASK);
-
- setFocusTraversalPolicy(KeyboardFocusManager.
- getCurrentKeyboardFocusManager().
- getDefaultFocusTraversalPolicy());
-
+ setFocusTraversalPolicy(KeyboardFocusManager.getCurrentKeyboardFocusManager()
+ .getDefaultFocusTraversalPolicy());
updateUIForFrame();
-
this.desktopIcon = new JDesktopIcon(this);
-
setRootPaneCheckingEnabled(true);
-
// non-selected internalFrame must have visible glassPane
getGlassPane().setVisible(true);
-
// just to be sure
super.setFocusCycleRoot(true);
}
@@ -463,22 +454,26 @@
* This class implements accessibility support for
* <code>JInternalFrame</code>.
*/
- protected class AccessibleJInternalFrame extends AccessibleJComponent
- implements AccessibleValue {
+ protected class AccessibleJInternalFrame extends AccessibleJComponent implements
+ AccessibleValue {
+ private static final long serialVersionUID = 8391910997005202445L;
private Number currentAccessibleValue = new Integer(0);
protected AccessibleJInternalFrame() {
}
+ @Override
public String getAccessibleName() {
return getTitle();
}
+ @Override
public AccessibleRole getAccessibleRole() {
return AccessibleRole.INTERNAL_FRAME;
}
+ @Override
public AccessibleValue getAccessibleValue() {
return this;
}
@@ -491,9 +486,8 @@
if (n == null) {
return false;
}
-
if (n instanceof Integer) {
- currentAccessibleValue = (Integer)n;
+ currentAccessibleValue = n;
} else {
// XXX: 1.5 migration: replace this line with the commented line
currentAccessibleValue = new Integer(n.intValue());
@@ -519,13 +513,12 @@
* @param constraints - the constraints to be kept
* @param index - the index
*/
- protected void addImpl(final Component comp, final Object constraints,
- final int index) {
+ @Override
+ protected void addImpl(final Component comp, final Object constraints, final int index) {
if (isRootPaneCheckingEnabled()) {
getContentPane().add(comp, constraints, index);
return;
}
-
super.addImpl(comp, constraints, index);
}
@@ -549,13 +542,14 @@
* @return UI object for this component
*/
public InternalFrameUI getUI() {
- return (InternalFrameUI)ui;
+ return (InternalFrameUI) ui;
}
/**
* Updates <code>UI's</code> for both <code>JInternalFrame</code>
* and <code>JDesktopIcon</code>.
*/
+ @Override
public void updateUI() {
updateUIForFrame();
if (getDesktopIcon() != null) {
@@ -564,7 +558,7 @@
}
void updateUIForFrame() {
- setUI((InternalFrameUI)UIManager.getUI(this));
+ setUI((InternalFrameUI) UIManager.getUI(this));
}
/**
@@ -591,8 +585,7 @@
* @return all registered internal frame listeners
*/
public InternalFrameListener[] getInternalFrameListeners() {
- return (InternalFrameListener[])
- listenerList.getListeners(InternalFrameListener.class);
+ return listenerList.getListeners(InternalFrameListener.class);
}
/**
@@ -603,42 +596,34 @@
protected void fireInternalFrameEvent(final int id) {
Object[] listeners = listenerList.getListenerList();
InternalFrameEvent e = null;
-
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == InternalFrameListener.class) {
if (e == null) {
e = new InternalFrameEvent(this, id);
}
-
- InternalFrameListener l = (InternalFrameListener)listeners[i + 1];
+ InternalFrameListener l = (InternalFrameListener) listeners[i + 1];
switch (id) {
- case InternalFrameEvent.INTERNAL_FRAME_ACTIVATED:
- l.internalFrameActivated(e);
- break;
-
- case InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED:
- l.internalFrameDeactivated(e);
- break;
-
- case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
- l.internalFrameIconified(e);
- break;
-
- case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
- l.internalFrameDeiconified(e);
- break;
-
- case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
- l.internalFrameClosing(e);
- break;
-
- case InternalFrameEvent.INTERNAL_FRAME_OPENED:
- l.internalFrameOpened(e);
- break;
-
- case InternalFrameEvent.INTERNAL_FRAME_CLOSED:
- l.internalFrameClosed(e);
- break;
+ case InternalFrameEvent.INTERNAL_FRAME_ACTIVATED:
+ l.internalFrameActivated(e);
+ break;
+ case InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED:
+ l.internalFrameDeactivated(e);
+ break;
+ case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
+ l.internalFrameIconified(e);
+ break;
+ case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
+ l.internalFrameDeiconified(e);
+ break;
+ case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
+ l.internalFrameClosing(e);
+ break;
+ case InternalFrameEvent.INTERNAL_FRAME_OPENED:
+ l.internalFrameOpened(e);
+ break;
+ case InternalFrameEvent.INTERNAL_FRAME_CLOSED:
+ l.internalFrameClosed(e);
+ break;
}
}
}
@@ -651,13 +636,10 @@
*/
protected void setRootPane(final JRootPane root) {
JRootPane oldValue = getRootPane();
-
if (rootPane != null) {
remove(rootPane);
}
-
rootPane = root;
-
if (root != null) {
super.addImpl(root, null, 0);
}
@@ -669,6 +651,7 @@
*
* @return rootPane property
*/
+ @Override
public JRootPane getRootPane() {
return rootPane;
}
@@ -686,6 +669,7 @@
/**
* @deprecated
*/
+ @Deprecated
public void setMenuBar(final JMenuBar menuBar) {
setJMenuBar(menuBar);
}
@@ -693,6 +677,7 @@
/**
* @deprecated
*/
+ @Deprecated
public JMenuBar getMenuBar() {
return getJMenuBar();
}
@@ -764,15 +749,11 @@
* <code>desktoIcon</code>
*/
public JDesktopPane getDesktopPane() {
- Container result = SwingUtilities.getAncestorOfClass(JDesktopPane.class,
- this);
-
+ Container result = SwingUtilities.getAncestorOfClass(JDesktopPane.class, this);
if (result == null) {
- result = SwingUtilities.getAncestorOfClass
- (JDesktopPane.class, getDesktopIcon());
+ result = SwingUtilities.getAncestorOfClass(JDesktopPane.class, getDesktopIcon());
}
-
- return (JDesktopPane)result;
+ return (JDesktopPane) result;
}
/**
@@ -780,11 +761,11 @@
*
* @return the accessible context for the internal frame
*/
+ @Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJInternalFrame();
}
-
return accessibleContext;
}
@@ -836,6 +817,7 @@
*
* @return string representation of this frame
*/
+ @Override
protected String paramString() {
return super.paramString();
}
@@ -856,6 +838,7 @@
*
* @return the string "InternalFrameUI"
*/
+ @Override
public String getUIClassID() {
return "InternalFrameUI";
}
@@ -879,7 +862,7 @@
public void setLayer(final int layer) {
//if (getDesktopPane() == null) {
if (getParent() instanceof JLayeredPane) {
- ((JLayeredPane)getParent()).setLayer(this, layer);
+ ((JLayeredPane) getParent()).setLayer(this, layer);
} else {
JLayeredPane.putLayer(this, layer);
}
@@ -913,6 +896,7 @@
return normalBounds;
}
+ @Override
public void setLayout(final LayoutManager layout) {
if (isRootPaneCheckingEnabled()) {
getContentPane().setLayout(layout);
@@ -927,6 +911,7 @@
*
* @param g the <code>Graphics</code> object to paint
*/
+ @Override
protected void paintComponent(final Graphics g) {
if (blitSupport != null) {
blitSupport.onPaint();
@@ -974,6 +959,7 @@
return getRootPane().getGlassPane();
}
+ @Override
public void remove(final Component comp) {
if (comp.getParent() == this) {
// remove directly from JInternalFrame
@@ -1009,22 +995,17 @@
if (isSelected()) {
return getFocusOwner();
}
-
if (mostRecentFocusOwner != null) {
return mostRecentFocusOwner;
}
-
Component result = null;
- if (getFocusTraversalPolicy() instanceof
- InternalFrameFocusTraversalPolicy) {
- result = ((InternalFrameFocusTraversalPolicy)getFocusTraversalPolicy()).
- getInitialComponent(this);
+ if (getFocusTraversalPolicy() instanceof InternalFrameFocusTraversalPolicy) {
+ result = ((InternalFrameFocusTraversalPolicy) getFocusTraversalPolicy())
+ .getInitialComponent(this);
}
-
if (result == null) {
return getFocusTraversalPolicy().getDefaultComponent(this);
}
-
return result;
}
@@ -1038,10 +1019,8 @@
if (!isSelected()) {
return null;
}
-
- Component focusOwner = KeyboardFocusManager.
- getCurrentKeyboardFocusManager().getFocusOwner();
-
+ Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager()
+ .getFocusOwner();
return isAncestorOf(focusOwner) ? focusOwner : null;
}
@@ -1071,19 +1050,15 @@
if (b && !isShowing() && !getDesktopIcon().isShowing()) {
return; // can't select if the internal frame is not showing
}
-
if (b == isSelected()) {
return;
}
-
Boolean oldValue = Boolean.valueOf(isSelected());
Boolean newValue = Boolean.valueOf(b);
fireVetoableChange(IS_SELECTED_PROPERTY, oldValue, newValue);
-
// remember the focused component for the deactivated frame;
// recall the last focused component for the activated frame;
setMostRecentFocusOwner(getMostRecentFocusOwner());
-
isSelected = b;
if (isSelected()) {
isSelected = false;
@@ -1091,11 +1066,9 @@
isSelected = true;
}
firePropertyChange(IS_SELECTED_PROPERTY, oldValue, newValue);
-
// fire internal frame events
- fireInternalFrameEvent(isSelected()
- ? InternalFrameEvent.INTERNAL_FRAME_ACTIVATED
- : InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED);
+ fireInternalFrameEvent(isSelected() ? InternalFrameEvent.INTERNAL_FRAME_ACTIVATED
+ : InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED);
}
/**
@@ -1136,8 +1109,7 @@
resizable = b;
LookAndFeel.markPropertyNotInstallable(this,
StringConstants.INTERNAL_FRAME_RESIZABLE_PROPERTY);
- firePropertyChange(StringConstants.INTERNAL_FRAME_RESIZABLE_PROPERTY,
- oldValue, b);
+ firePropertyChange(StringConstants.INTERNAL_FRAME_RESIZABLE_PROPERTY, oldValue, b);
}
/**
@@ -1160,11 +1132,9 @@
Boolean oldValue = Boolean.valueOf(isMaximum());
Boolean newValue = Boolean.valueOf(b);
fireVetoableChange(IS_MAXIMUM_PROPERTY, oldValue, newValue);
-
if (b && !isMaximum()) {
setNormalBounds(getBounds());
}
-
isMaximum = b;
firePropertyChange(IS_MAXIMUM_PROPERTY, oldValue, newValue);
}
@@ -1188,8 +1158,7 @@
maximizable = b;
LookAndFeel.markPropertyNotInstallable(this,
StringConstants.INTERNAL_FRAME_MAXIMIZABLE_PROPERTY);
- firePropertyChange(StringConstants.INTERNAL_FRAME_MAXIMIZABLE_PROPERTY,
- oldValue, b);
+ firePropertyChange(StringConstants.INTERNAL_FRAME_MAXIMIZABLE_PROPERTY, oldValue, b);
}
/**
@@ -1211,8 +1180,7 @@
iconable = b;
LookAndFeel.markPropertyNotInstallable(this,
StringConstants.INTERNAL_FRAME_ICONABLE_PROPERTY);
- firePropertyChange(StringConstants.INTERNAL_FRAME_ICONABLE_PROPERTY,
- oldValue, b);
+ firePropertyChange(StringConstants.INTERNAL_FRAME_ICONABLE_PROPERTY, oldValue, b);
}
/**
@@ -1239,10 +1207,8 @@
Boolean oldValue = Boolean.valueOf(isIcon());
Boolean newValue = Boolean.valueOf(b);
fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
-
isIcon = b;
firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
-
// fire internal frame events
if (oldValue.booleanValue() != b) {
if (oldValue.booleanValue()) {
@@ -1268,6 +1234,7 @@
*
* @param b the value is ignored
*/
+ @Override
public final void setFocusCycleRoot(final boolean b) {
// do nothing
}
@@ -1278,6 +1245,7 @@
*
* @return true
*/
+ @Override
public final boolean isFocusCycleRoot() {
return true;
}
@@ -1288,6 +1256,7 @@
*
* @return null
*/
+ @Override
public final Container getFocusCycleRootAncestor() {
return null;
}
@@ -1304,12 +1273,8 @@
if (isClosed() || !b) {
return;
}
-
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSING);
-
- fireVetoableChange(IS_CLOSED_PROPERTY,
- Boolean.valueOf(isClosed()), Boolean.valueOf(b));
-
+ fireVetoableChange(IS_CLOSED_PROPERTY, Boolean.valueOf(isClosed()), Boolean.valueOf(b));
dispose();
}
@@ -1334,8 +1299,7 @@
closable = b;
LookAndFeel.markPropertyNotInstallable(this,
StringConstants.INTERNAL_FRAME_CLOSABLE_PROPERTY);
- firePropertyChange(StringConstants.INTERNAL_FRAME_CLOSABLE_PROPERTY,
- oldValue, b);
+ firePropertyChange(StringConstants.INTERNAL_FRAME_CLOSABLE_PROPERTY, oldValue, b);
}
/**
@@ -1371,16 +1335,15 @@
*/
public void doDefaultCloseAction() {
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSING);
-
switch (getDefaultCloseOperation()) {
- case DISPOSE_ON_CLOSE: // dispose
- dispose();
- break;
- case HIDE_ON_CLOSE: // hide
- setVisible(false);
- break;
- case DO_NOTHING_ON_CLOSE: // do nothing
- break;
+ case DISPOSE_ON_CLOSE: // dispose
+ dispose();
+ break;
+ case HIDE_ON_CLOSE: // hide
+ setVisible(false);
+ break;
+ case DO_NOTHING_ON_CLOSE: // do nothing
+ break;
}
}
@@ -1390,7 +1353,7 @@
*/
public void moveToFront() {
if (getParent() instanceof JLayeredPane) {
- ((JLayeredPane)getParent()).setPosition(this, 0);
+ ((JLayeredPane) getParent()).setPosition(this, 0);
}
}
@@ -1400,7 +1363,7 @@
*/
public void moveToBack() {
if (getParent() instanceof JLayeredPane) {
- ((JLayeredPane)getParent()).setPosition(this, -1);
+ ((JLayeredPane) getParent()).setPosition(this, -1);
}
}
@@ -1435,6 +1398,9 @@
* is fired. The method does nothing if the internal frame is already
* visible.
*/
+ @SuppressWarnings("deprecation")
+ @Override
+ @Deprecated
public void show() {
if (isVisible()) {
return;
@@ -1442,23 +1408,17 @@
if (blitSupport == null) {
blitSupport = new BlitSupport(this);
}
-
if (getDesktopIcon() != null) {
getDesktopIcon().setVisible(true);
}
-
moveToFront();
-
// Note: how to set isVisible to true without calling of obsolete method?
// cannot use super.setVisibile(true) - stack overflow will occur
super.show();
-
try {
setSelected(true);
} catch (final PropertyVetoException e) {
-
}
-
// fire INTERNAL_FRAME_OPENED when opening the first time
if (firstTimeOpen) {
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
@@ -1466,9 +1426,11 @@
}
}
+ @SuppressWarnings("deprecation")
+ @Override
+ @Deprecated
public void hide() {
super.hide();
-
// the desktop icon becomes visible when the internal frame becomes
// visible; the same is correct for hiding
if (getDesktopIcon() != null) {
@@ -1487,16 +1449,15 @@
setSelected(false);
} catch (final PropertyVetoException e) {
}
-
boolean oldValue = isClosed();
isClosed = true;
firePropertyChange(IS_CLOSED_PROPERTY, oldValue, true);
-
if (!oldValue) {
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED);
}
}
+ @Override
public void setBounds(final int x, final int y, final int w, final int h) {
Dimension oldSize = getSize();
super.setBounds(x, y, w, h);
@@ -1504,7 +1465,6 @@
validate();
return;
}
-
if (blitSupport != null) {
blitSupport.paint();
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JLabel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JLabel.java?view=diff&rev=479507&r1=479506&r2=479507
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JLabel.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JLabel.java Sun Nov 26 19:46:23 2006
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Anton Avtamonov
- * @version $Revision$
- */
-
package javax.swing;
import java.awt.Component;
@@ -28,31 +23,51 @@
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleText;
import javax.swing.plaf.LabelUI;
import javax.swing.text.AttributeSet;
-
+import org.apache.harmony.luni.util.NotImplementedException;
import org.apache.harmony.x.swing.StringConstants;
import org.apache.harmony.x.swing.Utilities;
-
+/**
+ * <p>
+ * <i>JLabel</i>
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as a guarantee of serialization compatibility.</li>
+ * </ul>
+ */
public class JLabel extends JComponent implements SwingConstants, Accessible {
+ private static final long serialVersionUID = 1992522068352176692L;
+
protected Component labelFor;
private String text;
+
private Icon icon;
+
private Icon disabledIcon;
+
private Icon defaultDisabledIcon;
+
private int horizontalAlignment;
+
private int horizontalTextPosition = TRAILING;
+
private int verticalAlignment = CENTER;
+
private int verticalTextPosition = CENTER;
+
private int iconTextGap = 4;
+
private int displayedMnemonicIndex = -1;
+
private int displayedMnemonic;
private AbstractAction labelForAction;
@@ -60,60 +75,66 @@
private static final String UI_CLASS_ID = "LabelUI";
private static final String DISPLAYED_MNEMONIC_CHANGED_PROPERTY = "displayedMnemonic";
+
private static final String LABEL_FOR_CHANGED_PROPERTY = "labelFor";
//TODO: implement
protected class AccessibleJLabel extends AccessibleJComponent implements AccessibleText {
+ private static final long serialVersionUID = -3843546598023238741L;
+
+ @Override
public AccessibleRole getAccessibleRole() {
return AccessibleRole.LABEL;
}
- public String getAfterIndex(final int part, final int index) {
- return null;
+ public String getAfterIndex(final int part, final int index)
+ throws NotImplementedException {
+ throw new NotImplementedException();
}
- public String getAtIndex(final int part, final int index) {
- return null;
+ public String getAtIndex(final int part, final int index)
+ throws NotImplementedException {
+ throw new NotImplementedException();
}
- public String getBeforeIndex(final int part, final int index) {
- return null;
+ public String getBeforeIndex(final int part, final int index)
+ throws NotImplementedException {
+ throw new NotImplementedException();
}
- public int getCaretPosition() {
- return 0;
+ public int getCaretPosition() throws NotImplementedException {
+ throw new NotImplementedException();
}
- public AttributeSet getCharacterAttribute(final int i) {
- return null;
+ public AttributeSet getCharacterAttribute(final int i) throws NotImplementedException {
+ throw new NotImplementedException();
}
- public Rectangle getCharacterBounds(final int i) {
- return null;
+ public Rectangle getCharacterBounds(final int i) throws NotImplementedException {
+ throw new NotImplementedException();
}
- public int getCharCount() {
- return 0;
+ public int getCharCount() throws NotImplementedException {
+ throw new NotImplementedException();
}
- public int getIndexAtPoint(final Point p) {
- return 0;
+ public int getIndexAtPoint(final Point p) throws NotImplementedException {
+ throw new NotImplementedException();
}
- public String getSelectedText() {
- return null;
+ public String getSelectedText() throws NotImplementedException {
+ throw new NotImplementedException();
}
- public int getSelectionEnd() {
- return 0;
+ public int getSelectionEnd() throws NotImplementedException {
+ throw new NotImplementedException();
}
- public int getSelectionStart() {
- return 0;
+ public int getSelectionStart() throws NotImplementedException {
+ throw new NotImplementedException();
}
}
-
public JLabel() {
this("");
}
@@ -136,7 +157,6 @@
public JLabel(final String text, final Icon icon, final int horizontalAlignment) {
checkHorizontalAligment(horizontalAlignment);
-
this.text = text;
this.icon = icon;
this.horizontalAlignment = horizontalAlignment;
@@ -148,18 +168,19 @@
}
public LabelUI getUI() {
- return (LabelUI)ui;
+ return (LabelUI) ui;
}
+ @Override
public String getUIClassID() {
return UI_CLASS_ID;
}
+ @Override
public void updateUI() {
- setUI((LabelUI)UIManager.getUI(this));
+ setUI((LabelUI) UIManager.getUI(this));
}
-
public void setIcon(final Icon icon) {
Icon oldValue = this.icon;
this.icon = icon;
@@ -182,7 +203,8 @@
return disabledIcon;
}
if (defaultDisabledIcon == null && icon instanceof ImageIcon) {
- defaultDisabledIcon = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage()));
+ defaultDisabledIcon = new ImageIcon(GrayFilter
+ .createDisabledImage(((ImageIcon) icon).getImage()));
}
return defaultDisabledIcon;
}
@@ -191,7 +213,8 @@
String oldValue = this.text;
this.text = text;
firePropertyChange(AbstractButton.TEXT_CHANGED_PROPERTY, oldValue, text);
- setDisplayedMnemonicIndex(Utilities.getDisplayedMnemonicIndex(text, Utilities.keyCodeToKeyChar(getDisplayedMnemonic())));
+ setDisplayedMnemonicIndex(Utilities.getDisplayedMnemonicIndex(text, Utilities
+ .keyCodeToKeyChar(getDisplayedMnemonic())));
}
public String getText() {
@@ -209,11 +232,12 @@
}
public void setIconTextGap(final int iconTextGap) {
- LookAndFeel.markPropertyNotInstallable(this, StringConstants.ICON_TEXT_GAP_PROPERTY_CHANGED);
-
+ LookAndFeel.markPropertyNotInstallable(this,
+ StringConstants.ICON_TEXT_GAP_PROPERTY_CHANGED);
int oldValue = this.iconTextGap;
this.iconTextGap = iconTextGap;
- firePropertyChange(StringConstants.ICON_TEXT_GAP_PROPERTY_CHANGED, oldValue, iconTextGap);
+ firePropertyChange(StringConstants.ICON_TEXT_GAP_PROPERTY_CHANGED, oldValue,
+ iconTextGap);
}
public int getIconTextGap() {
@@ -222,10 +246,10 @@
public void setVerticalTextPosition(final int textPosition) {
checkVerticalKey(textPosition, "incorrect vertical text position specified");
-
int oldValue = this.verticalTextPosition;
this.verticalTextPosition = textPosition;
- firePropertyChange(AbstractButton.VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, oldValue, textPosition);
+ firePropertyChange(AbstractButton.VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, oldValue,
+ textPosition);
}
public int getVerticalTextPosition() {
@@ -234,10 +258,10 @@
public void setVerticalAlignment(final int alignment) {
checkVerticalKey(alignment, "incorrect vertical aligment specified");
-
int oldValue = this.verticalAlignment;
this.verticalAlignment = alignment;
- firePropertyChange(AbstractButton.VERTICAL_ALIGNMENT_CHANGED_PROPERTY, oldValue, alignment);
+ firePropertyChange(AbstractButton.VERTICAL_ALIGNMENT_CHANGED_PROPERTY, oldValue,
+ alignment);
}
public int getVerticalAlignment() {
@@ -246,10 +270,10 @@
public void setHorizontalTextPosition(final int textPosition) {
checkHorizontalKey(textPosition, "incorrect horizontal text position specified");
-
int oldValue = this.horizontalTextPosition;
this.horizontalTextPosition = textPosition;
- firePropertyChange(AbstractButton.HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, oldValue, textPosition);
+ firePropertyChange(AbstractButton.HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, oldValue,
+ textPosition);
}
public int getHorizontalTextPosition() {
@@ -258,10 +282,10 @@
public void setHorizontalAlignment(final int alignment) {
checkHorizontalAligment(alignment);
-
int oldValue = this.horizontalAlignment;
this.horizontalAlignment = alignment;
- firePropertyChange(AbstractButton.HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, oldValue, alignment);
+ firePropertyChange(AbstractButton.HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, oldValue,
+ alignment);
}
public int getHorizontalAlignment() {
@@ -269,14 +293,12 @@
}
public void setDisplayedMnemonicIndex(final int index) {
- if (index < -1 || index >=0 && (text == null || index >= text.length())) {
+ if (index < -1 || index >= 0 && (text == null || index >= text.length())) {
throw new IllegalArgumentException("Invalid index is specified");
}
-
int oldValue = this.displayedMnemonicIndex;
this.displayedMnemonicIndex = index;
- firePropertyChange(StringConstants.MNEMONIC_INDEX_PROPERTY_CHANGED,
- oldValue, index);
+ firePropertyChange(StringConstants.MNEMONIC_INDEX_PROPERTY_CHANGED, oldValue, index);
}
public int getDisplayedMnemonicIndex() {
@@ -295,25 +317,25 @@
return displayedMnemonic;
}
+ @Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJLabel();
}
-
return accessibleContext;
}
- public boolean imageUpdate(final Image image, final int infoflags, final int x, final int y, final int w, final int h) {
+ @Override
+ public boolean imageUpdate(final Image image, final int infoflags, final int x,
+ final int y, final int w, final int h) {
Icon currentIcon = isEnabled() ? getIcon() : getDisabledIcon();
-
- if (image != null && (currentIcon instanceof ImageIcon) && !image.equals(((ImageIcon)currentIcon).getImage())) {
+ if (image != null && (currentIcon instanceof ImageIcon)
+ && !image.equals(((ImageIcon) currentIcon).getImage())) {
return false;
- } else {
- return super.imageUpdate(image, infoflags, x, y, w, h);
}
+ return super.imageUpdate(image, infoflags, x, y, w, h);
}
-
protected int checkVerticalKey(final int key, final String message) {
return Utilities.checkVerticalKey(key, message);
}
@@ -322,20 +344,18 @@
return Utilities.checkHorizontalKey(key, message);
}
-
private void setDisplayedMnemonic(final int keyCode, final char keyChar) {
int oldValue = this.displayedMnemonic;
if (oldValue != keyCode) {
if (displayedMnemonic != 0) {
- getInputMap(WHEN_IN_FOCUSED_WINDOW, true).remove(KeyStroke.getKeyStroke(displayedMnemonic, InputEvent.ALT_DOWN_MASK));
+ getInputMap(WHEN_IN_FOCUSED_WINDOW, true).remove(
+ KeyStroke.getKeyStroke(displayedMnemonic, InputEvent.ALT_DOWN_MASK));
}
-
this.displayedMnemonic = keyCode;
-
String mnemonic = "mnemonic";
- getInputMap(WHEN_IN_FOCUSED_WINDOW, true).put(KeyStroke.getKeyStroke(keyCode, InputEvent.ALT_DOWN_MASK), mnemonic);
+ getInputMap(WHEN_IN_FOCUSED_WINDOW, true).put(
+ KeyStroke.getKeyStroke(keyCode, InputEvent.ALT_DOWN_MASK), mnemonic);
getActionMap(true).put(mnemonic, getLabelForAction());
-
firePropertyChange(DISPLAYED_MNEMONIC_CHANGED_PROPERTY, oldValue, keyCode);
setDisplayedMnemonicIndex(Utilities.getDisplayedMnemonicIndex(text, keyChar));
}
@@ -348,15 +368,16 @@
private AbstractAction getLabelForAction() {
if (labelForAction == null) {
labelForAction = new AbstractAction() {
+ private static final long serialVersionUID = 1L;
+
public void actionPerformed(final ActionEvent e) {
- if (isVisible() && isEnabled() && labelFor != null && labelFor.isVisible() && labelFor.isEnabled()) {
+ if (isVisible() && isEnabled() && labelFor != null && labelFor.isVisible()
+ && labelFor.isEnabled()) {
labelFor.requestFocus();
}
}
};
}
-
return labelForAction;
}
}
-
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JLayeredPane.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JLayeredPane.java?view=diff&rev=479507&r1=479506&r2=479507
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JLayeredPane.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JLayeredPane.java Sun Nov 26 19:46:23 2006
@@ -14,51 +14,54 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/**
- * @author Vadim L. Bogdanov
- * @version $Revision$
- */
-
package javax.swing;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
-
import java.util.Hashtable;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
/**
- * This class implements a containter with support of layers.
- *
+ * <p>
+ * <i>JLabel</i> implements a container with support for layers.
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as a guarantee of serialization compatibility.</li>
+ * </ul>
*/
public class JLayeredPane extends JComponent implements Accessible {
+ private static final long serialVersionUID = -2657754894035116214L;
private static final int DELAULT_LAYER_NUMBER = 0;
+
private static final int PALETTE_LAYER_NUMBER = 100;
+
private static final int MODAL_LAYER_NUMBER = 200;
+
private static final int POPUP_LAYER_NUMBER = 300;
+
private static final int DRAG_LAYER_NUMBER = 400;
+
private static final int FRAME_CONTENT_LAYER_NUMBER = -30000;
public static final Integer DEFAULT_LAYER;
+
public static final Integer PALETTE_LAYER;
+
public static final Integer MODAL_LAYER;
+
public static final Integer POPUP_LAYER;
+
public static final Integer DRAG_LAYER;
+
public static final Integer FRAME_CONTENT_LAYER;
public static final String LAYER_PROPERTY = "layeredContainerLayer";
-
- /**
- * The hash table used to store layers for components.
- */
- private Hashtable<java.awt.Component, java.lang.Integer> componentToLayer;
-
static {
DEFAULT_LAYER = new Integer(DELAULT_LAYER_NUMBER);
PALETTE_LAYER = new Integer(PALETTE_LAYER_NUMBER);
@@ -69,19 +72,16 @@
}
/**
- * Constructs new <code>JLayeredPane</code>
- */
- public JLayeredPane() {
- }
-
- /**
* Implements accessibility support for <code>JLayeredPane</code>
*/
protected class AccessibleJLayeredPane extends AccessibleJComponent {
+ private static final long serialVersionUID = 3492700363505144784L;
+
/**
* Constructs new <code>AccessibleJLayeredPane</code>.
*/
protected AccessibleJLayeredPane() {
+ super();
}
/**
@@ -90,12 +90,25 @@
* @return <code>AccessibleRole</code> that describes the accessible
* role of the object
*/
+ @Override
public AccessibleRole getAccessibleRole() {
return AccessibleRole.LAYERED_PANE;
}
}
/**
+ * The hash table used to store layers for components.
+ */
+ private Hashtable<Component, Integer> componentToLayer;
+
+ /**
+ * Constructs new <code>JLayeredPane</code>
+ */
+ public JLayeredPane() {
+ super();
+ }
+
+ /**
* Adds the specified component to the container using the specified
* index and the specified constraints.
*
@@ -104,22 +117,19 @@
* @param index position of the component in the layer, where
* -1 means the bottommost position and 0 means the topmost position
*/
- protected void addImpl(final Component comp, final Object constraints,
- final int index) {
+ @Override
+ protected void addImpl(final Component comp, final Object constraints, final int index) {
super.remove(comp);
-
int layer = DELAULT_LAYER_NUMBER;
Object newConstraints = constraints;
if (constraints == null) {
layer = getLayer(comp);
} else if (constraints instanceof Integer) {
- layer = ((Integer)constraints).intValue();
+ layer = ((Integer) constraints).intValue();
newConstraints = null;
rememberLayerForComponent(comp, layer);
}
-
super.addImpl(comp, newConstraints, insertIndexForLayer(layer, index));
-
/*
* Unlike other containers, JLayeredPane has to validate added
* components immediatelly (this is used, for example, in tool tips
@@ -133,11 +143,11 @@
*
* @return <code>AccessibleContext</code> associated with this layered pane
*/
+ @Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJLayeredPane();
}
-
return accessibleContext;
}
@@ -152,7 +162,6 @@
if (componentToLayer == null) {
componentToLayer = new Hashtable<java.awt.Component, java.lang.Integer>();
}
-
return componentToLayer;
}
@@ -161,6 +170,7 @@
*
* @return string representation of this layered pane
*/
+ @Override
protected String paramString() {
return super.paramString();
}
@@ -175,25 +185,19 @@
protected Integer getObjectForLayer(final int layer) {
// TODO: replace with Integer.valueOf(layer) after migrating to 1.5
switch (layer) {
- case DELAULT_LAYER_NUMBER:
- return DEFAULT_LAYER;
-
- case PALETTE_LAYER_NUMBER:
- return PALETTE_LAYER;
-
- case MODAL_LAYER_NUMBER:
- return MODAL_LAYER;
-
- case POPUP_LAYER_NUMBER:
- return POPUP_LAYER;
-
- case DRAG_LAYER_NUMBER:
- return DRAG_LAYER;
-
- case FRAME_CONTENT_LAYER_NUMBER:
- return FRAME_CONTENT_LAYER;
+ case DELAULT_LAYER_NUMBER:
+ return DEFAULT_LAYER;
+ case PALETTE_LAYER_NUMBER:
+ return PALETTE_LAYER;
+ case MODAL_LAYER_NUMBER:
+ return MODAL_LAYER;
+ case POPUP_LAYER_NUMBER:
+ return POPUP_LAYER;
+ case DRAG_LAYER_NUMBER:
+ return DRAG_LAYER;
+ case FRAME_CONTENT_LAYER_NUMBER:
+ return FRAME_CONTENT_LAYER;
}
-
return new Integer(layer);
}
@@ -202,6 +206,7 @@
*
* @param g the graphic context
*/
+ @Override
public void paint(final Graphics g) {
// JLayeredPane doesn't have UI,
// it has to paint its background by itself
@@ -212,7 +217,6 @@
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(savedColor);
}
-
super.paint(g);
}
@@ -224,15 +228,12 @@
* @param position the position to set, 0 means the topmost position and
* -1 means the bottommost position
*/
- public void setLayer(final Component c, final int layer,
- final int position) {
+ public void setLayer(final Component c, final int layer, final int position) {
int index = getIndexOf(c);
-
if (index == -1 || index == insertIndexForLayer(layer, position)) {
rememberLayerForComponent(c, layer);
return;
}
-
addImpl(c, getObjectForLayer(layer), position);
}
@@ -260,7 +261,6 @@
// do nothing if c is not in the container
return;
}
-
setLayer(c, layer, position);
}
@@ -293,11 +293,9 @@
int index = getIndexOf(c);
int layer = getLayer(c);
int pos = -1;
-
for (; index >= 0 && getLayer(getComponent(index)) == layer; index--) {
pos++;
}
-
return pos;
}
@@ -311,14 +309,12 @@
if (c == null) {
return -1;
}
-
Object layer = getComponentToLayer().get(c);
if (layer != null) {
- return ((Integer)layer).intValue();
+ return ((Integer) layer).intValue();
}
-
if (c instanceof JComponent) {
- return getLayer((JComponent)c);
+ return getLayer((JComponent) c);
}
return 0;
}
@@ -330,19 +326,14 @@
public Component[] getComponentsInLayer(final int layer) {
int size = getComponentCountInLayer(layer);
Component[] result = new Component[size];
-
if (size == 0) {
return result;
}
-
int i = insertIndexForLayer(layer, 0);
-
int j = 0;
- for (; i < getComponentCount() && layer == getLayer(getComponent(i));
- i++, j++) {
+ for (; i < getComponentCount() && layer == getLayer(getComponent(i)); i++, j++) {
result[j] = getComponent(i);
}
-
return result;
}
@@ -350,16 +341,11 @@
return insertIndexForLayer(layer, position, 0);
}
- private int insertIndexForLayer(final int layer, final int position,
- final int startPosition) {
- assert startPosition == 0
- || getLayer(getComponent(startPosition - 1)) > layer
- : "startPosition in the middle of the current layer";
-
+ private int insertIndexForLayer(final int layer, final int position, final int startPosition) {
+ assert startPosition == 0 || getLayer(getComponent(startPosition - 1)) > layer : "startPosition in the middle of the current layer";
if (getComponentCount() == 0) {
return 0;
}
-
// the bottommost position of layer n
// is equivalent to topmost position of level n-1
int adjustedPosition = position;
@@ -368,7 +354,6 @@
adjustedPosition = 0;
adjustedLayer = layer - 1;
}
-
int result = startPosition;
// looking position depending on layer
for (; result < getComponentCount(); result++) {
@@ -376,25 +361,23 @@
break;
}
}
-
// looking for position depending on index in layer
- for (; result < getComponentCount() && adjustedPosition > 0;
- result++, adjustedPosition--) {
+ for (; result < getComponentCount() && adjustedPosition > 0; result++, adjustedPosition--) {
if (getLayer(getComponent(result)) != adjustedLayer) {
break;
}
}
-
return result;
}
+ @Override
public void remove(final int index) {
Component comp = getComponent(index);
getComponentToLayer().remove(comp);
-
super.remove(index);
}
+ @Override
public void removeAll() {
for (int i = getComponentCount() - 1; i >= 0; i--) {
remove(i);
@@ -405,11 +388,11 @@
if (layer < lowestLayer() || layer > highestLayer()) {
return 0;
}
-
int start = insertIndexForLayer(layer, 0);
return insertIndexForLayer(layer, -1, start) - start;
}
+ @Override
public boolean isOptimizedDrawingEnabled() {
return getComponentCount() <= 1;
}
@@ -429,12 +412,11 @@
}
public static JLayeredPane getLayeredPaneAbove(final Component c) {
- return (JLayeredPane)SwingUtilities.
- getAncestorOfClass(JLayeredPane.class, c);
+ return (JLayeredPane) SwingUtilities.getAncestorOfClass(JLayeredPane.class, c);
}
public static void putLayer(final JComponent c, final int layer) {
- Integer l = (Integer)c.getClientProperty(LAYER_PROPERTY);
+ Integer l = (Integer) c.getClientProperty(LAYER_PROPERTY);
if (l == null || l.intValue() != layer) {
// the layer is really changed
c.putClientProperty(LAYER_PROPERTY, new Integer(layer));
@@ -442,14 +424,13 @@
}
public static int getLayer(final JComponent c) {
- Integer layer = ((Integer)c.getClientProperty(LAYER_PROPERTY));
+ Integer layer = ((Integer) c.getClientProperty(LAYER_PROPERTY));
return layer == null ? 0 : layer.intValue();
}
- private void rememberLayerForComponent(final Component c,
- final int layer) {
+ private void rememberLayerForComponent(final Component c, final int layer) {
if (c instanceof JComponent) {
- putLayer((JComponent)c, layer);
+ putLayer((JComponent) c, layer);
}
getComponentToLayer().put(c, getObjectForLayer(layer));
}