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/26 01:04:16 UTC

svn commit: r479240 [27/28] - /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/SwingUtilitiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/SwingUtilitiesTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/SwingUtilitiesTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/SwingUtilitiesTest.java Sat Nov 25 16:04:10 2006
@@ -44,19 +44,19 @@
 import java.awt.event.MouseEvent;
 import java.awt.image.BufferedImage;
 import java.beans.PropertyChangeListener;
-
 import javax.accessibility.AccessibleState;
 import javax.accessibility.AccessibleStateSet;
 import javax.swing.border.EmptyBorder;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.UIResource;
 
-public class SwingUtilitiesTest extends SwingTestCase implements SwingConstants{
-
+public class SwingUtilitiesTest extends SwingTestCase implements SwingConstants {
     class UIActionMap extends ActionMap implements UIResource {
+        private static final long serialVersionUID = 1L;
     }
 
     class UIInputMap extends InputMap implements UIResource {
+        private static final long serialVersionUID = 1L;
     }
 
     /*
@@ -70,80 +70,60 @@
         Rectangle iconR = new Rectangle(0, 0, 0, 0);
         Rectangle textR = new Rectangle(0, 0, 0, 0);
         String initialString = "Long enough text for this label, can you see that it is clipped now?";
-
         Icon icon = new ImageIcon(new BufferedImage(30, 40, BufferedImage.TYPE_4BYTE_ABGR));
         String clippedStr = null;
         clippedStr = SwingUtilities.layoutCompoundLabel(panel, metrics, initialString, icon,
                 TOP, CENTER, BOTTOM, RIGHT, viewR, iconR, textR, 30);
-
         assertEquals("clipped string ", "Long...", clippedStr);
         assertEquals("icon rectangle ", new Rectangle(3, 0, 30, 40), iconR);
         assertEquals("text rectangle ", new Rectangle(63, 2, 84, 38), textR);
-
         viewR = new Rectangle(20, 20, 100, 100);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
         clippedStr = SwingUtilities.layoutCompoundLabel(panel, metrics, initialString, icon,
                 CENTER, CENTER, TOP, RIGHT, viewR, iconR, textR, 30);
-
         assertEquals("clipped string ", "...", clippedStr);
         assertEquals("icon rectangle ", new Rectangle(22, 50, 30, 40), iconR);
         assertEquals("text rectangle ", new Rectangle(82, 50, 36, 38), textR);
-
         panel.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
         viewR = new Rectangle(20, 20, 130, 100);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
         clippedStr = SwingUtilities.layoutCompoundLabel(panel, metrics, initialString, icon,
                 CENTER, CENTER, TOP, LEADING, viewR, iconR, textR, 30);
-
         assertEquals("clipped string ", "Lo...", clippedStr);
         assertEquals("icon rectangle ", new Rectangle(25, 50, 30, 40), iconR);
         assertEquals("text rectangle ", new Rectangle(85, 50, 60, 38), textR);
-
         viewR = new Rectangle(0, 0, 292, 200);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-
         JLabel label = new JLabel();
         icon = new ImageIcon(new BufferedImage(16, 16, BufferedImage.TYPE_3BYTE_BGR));
         metrics = getFontMetrics(font, 34);
-        clippedStr = SwingUtilities.layoutCompoundLabel(label, metrics, "Hello world you are great!", icon,
-                BOTTOM, CENTER, BOTTOM, TRAILING, viewR, iconR, textR, label.getIconTextGap());
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(label, metrics,
+                "Hello world you are great!", icon, BOTTOM, CENTER, BOTTOM, TRAILING, viewR,
+                iconR, textR, label.getIconTextGap());
         assertEquals("clipped string ", "Hello...", clippedStr);
         assertEquals("icon rectangle ", new Rectangle(0, 184, 16, 16), iconR);
         assertEquals("text rectangle ", new Rectangle(20, 96, 272, 104), textR);
-
         if (isHarmony()) {
-            icon = new ImageIcon(new BufferedImage(52, 64,
-                    BufferedImage.TYPE_4BYTE_ABGR));
+            icon = new ImageIcon(new BufferedImage(52, 64, BufferedImage.TYPE_4BYTE_ABGR));
             metrics = getFontMetrics(font, 12);
             viewR = new Rectangle(120, 120, 1280, 280);
-            clippedStr = SwingUtilities.layoutCompoundLabel(panel, metrics,
-                    initialString, icon, CENTER, CENTER, CENTER, LEADING,
-                    viewR, iconR, textR, 30);
-
-            assertEquals(
-                    "clipped string ",
+            clippedStr = SwingUtilities.layoutCompoundLabel(panel, metrics, initialString,
+                    icon, CENTER, CENTER, CENTER, LEADING, viewR, iconR, textR, 30);
+            assertEquals("clipped string ",
                     "Long enough text for this label, can you see that it is clipped now?",
                     clippedStr);
-            assertEquals("icon rectangle ", new Rectangle(311, 228, 52, 64),
-                    iconR);
-            assertEquals("text rectangle ", new Rectangle(393, 241, 816, 38),
-                    textR);
-
+            assertEquals("icon rectangle ", new Rectangle(311, 228, 52, 64), iconR);
+            assertEquals("text rectangle ", new Rectangle(393, 241, 816, 38), textR);
             panel.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
             viewR = new Rectangle(120, 120, 40, 40);
-            clippedStr = SwingUtilities.layoutCompoundLabel(panel, metrics,
-                    initialString, icon, CENTER, CENTER, CENTER, LEADING,
-                    viewR, iconR, textR, 30);
-
+            clippedStr = SwingUtilities.layoutCompoundLabel(panel, metrics, initialString,
+                    icon, CENTER, CENTER, CENTER, LEADING, viewR, iconR, textR, 30);
             assertEquals("clipped string ", "...", clippedStr);
-            assertEquals("icon rectangle ", new Rectangle(147, 108, 52, 64),
-                    iconR);
-            assertEquals("text rectangle ", new Rectangle(81, 121, 36, 38),
-                    textR);
+            assertEquals("icon rectangle ", new Rectangle(147, 108, 52, 64), iconR);
+            assertEquals("text rectangle ", new Rectangle(81, 121, 36, 38), textR);
         }
     }
 
@@ -153,161 +133,140 @@
     public void testLayoutCompoundLabelFontMetricsStringIconintintintintRectangleRectangleRectangleint() {
         Font font = new Font("Fixed", Font.PLAIN, 12);
         FontMetrics metrics = getFontMetrics(font);
-
         Rectangle viewR = new Rectangle(0, 0, 10, 10);
         Rectangle iconR = new Rectangle(0, 0, 0, 0);
         Rectangle textR = new Rectangle(0, 0, 0, 0);
-
-        String clippedStr = SwingUtilities.layoutCompoundLabel(metrics, null, null, CENTER, LEADING, CENTER, LEADING, viewR, iconR, textR, 2);
-
+        String clippedStr = SwingUtilities.layoutCompoundLabel(metrics, null, null, CENTER,
+                LEADING, CENTER, LEADING, viewR, iconR, textR, 2);
         assertEquals("clipped string ", "", clippedStr);
         assertTrue("icon rectangle ", iconR.isEmpty());
         assertTrue("text rectangle ", textR.isEmpty());
-
         viewR = new Rectangle(0, 0, 150, 150);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
         String initialString = "Long enough text for this label, can you see that it is clipped now?";
-
         Icon icon = null;
         metrics = getFontMetrics(font, 5);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                TOP, CENTER, BOTTOM, RIGHT, viewR, iconR, textR, 30);
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, TOP,
+                CENTER, BOTTOM, RIGHT, viewR, iconR, textR, 30);
         assertEquals("clipped string ", "Long enough text for this l...", clippedStr);
         assertTrue("icon rectangle ", iconR.isEmpty());
         assertEquals("text rectangle ", new Rectangle(0, 0, 150, 17), textR);
-
         viewR = new Rectangle(0, 0, 150, 150);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-
         metrics = getFontMetrics(font, 5);
         icon = new ImageIcon(new BufferedImage(30, 40, BufferedImage.TYPE_4BYTE_ABGR));
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                TOP, CENTER, BOTTOM, RIGHT, viewR, iconR, textR, 30);
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, TOP,
+                CENTER, BOTTOM, RIGHT, viewR, iconR, textR, 30);
         assertEquals("clipped string ", "Long enough tex...", clippedStr);
         assertEquals("icon rectangle ", new Rectangle(0, 0, 30, 40), iconR);
         assertEquals("text rectangle ", new Rectangle(60, 23, 90, 17), textR);
-
         viewR = new Rectangle(20, 20, 100, 100);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
         metrics = getFontMetrics(font, 5);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                CENTER, CENTER, TOP, RIGHT, viewR, iconR, textR, 30);
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, CENTER,
+                CENTER, TOP, RIGHT, viewR, iconR, textR, 30);
         assertEquals("clipped string ", "Long ...", clippedStr);
         assertEquals("icon rectangle ", new Rectangle(20, 50, 30, 40), iconR);
         assertEquals("text rectangle ", new Rectangle(80, 50, 40, 17), textR);
-
         icon = new ImageIcon(new BufferedImage(52, 64, BufferedImage.TYPE_4BYTE_ABGR));
         metrics = getFontMetrics(font, 24);
         viewR = new Rectangle(100, 100, 1500, 300);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                CENTER, CENTER, CENTER, RIGHT, viewR, iconR, textR, 30);
-
-        assertEquals("clipped string ", "Long enough text for this label, can you see that it is ...", clippedStr);
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, CENTER,
+                CENTER, CENTER, RIGHT, viewR, iconR, textR, 30);
+        assertEquals("clipped string ",
+                "Long enough text for this label, can you see that it is ...", clippedStr);
         assertEquals("icon rectangle ", new Rectangle(101, 218, 52, 64), iconR);
         assertEquals("text rectangle ", new Rectangle(183, 213, 1416, 74), textR);
-
         icon = new ImageIcon(new BufferedImage(52, 64, BufferedImage.TYPE_4BYTE_ABGR));
         viewR = new Rectangle(100, 100, 1500, 300);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, null, icon,
-                CENTER, CENTER, CENTER, RIGHT, viewR, iconR, textR, 30);
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, null, icon, CENTER, CENTER,
+                CENTER, RIGHT, viewR, iconR, textR, 30);
         assertEquals("clipped string ", "", clippedStr);
         assertEquals("icon rectangle ", new Rectangle(824, 218, 52, 64), iconR);
         assertTrue("text rectangle ", textR.isEmpty());
-
         icon = null;
         metrics = getFontMetrics(font, 6);
         viewR = new Rectangle(0, 0, 4, 300);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                CENTER, CENTER, CENTER, RIGHT, viewR, iconR, textR, 0);
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, CENTER,
+                CENTER, CENTER, RIGHT, viewR, iconR, textR, 0);
         assertEquals("clipped string ", "...", clippedStr);
-
         icon = null;
         viewR = new Rectangle(0, 0, 2, 300);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                CENTER, CENTER, CENTER, LEADING, viewR, iconR, textR, 0);
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, CENTER,
+                CENTER, CENTER, LEADING, viewR, iconR, textR, 0);
         assertEquals("clipped string ", "...", clippedStr);
-
         icon = null;
         metrics = getFontMetrics(font, 30);
         viewR = new Rectangle(0, 0, 500, 300);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                CENTER, CENTER, CENTER, RIGHT, viewR, iconR, textR, 0);
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, CENTER,
+                CENTER, CENTER, RIGHT, viewR, iconR, textR, 0);
         assertEquals("clipped string ", "Long enough t...", clippedStr);
-
         icon = null;
         metrics = getFontMetrics(font, 16);
         viewR = new Rectangle(0, 0, 500, 300);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, "WWWWWWWWWWWWWWWWWWWW,,,,,,,,,,,,,,,,,,,,,,", icon,
-                CENTER, CENTER, CENTER, RIGHT, viewR, iconR, textR, 0);
-
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics,
+                "WWWWWWWWWWWWWWWWWWWW,,,,,,,,,,,,,,,,,,,,,,", icon, CENTER, CENTER, CENTER,
+                RIGHT, viewR, iconR, textR, 0);
         assertEquals("clipped string ", "WWWWWWWWWWWWWWWWWWWW,,,,,,,,...", clippedStr);
-
         icon = new ImageIcon(new BufferedImage(52, 64, BufferedImage.TYPE_4BYTE_ABGR));
         metrics = getFontMetrics(font, 30);
         viewR = new Rectangle(100, 100, 1500, 300);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                CENTER, CENTER, TOP, CENTER, viewR, iconR, textR, 30);
-        assertEquals("clipped string ", "Long enough text for this label, can you see th...", clippedStr);
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, CENTER,
+                CENTER, TOP, CENTER, viewR, iconR, textR, 30);
+        assertEquals("clipped string ", "Long enough text for this label, can you see th...",
+                clippedStr);
         assertEquals("icon rectangle ", new Rectangle(824, 279, 52, 64), iconR);
         assertEquals("text rectangle ", new Rectangle(100, 157, 1500, 92), textR);
-
         icon = new ImageIcon(new BufferedImage(52, 64, BufferedImage.TYPE_4BYTE_ABGR));
         metrics = getFontMetrics(font, 28);
         viewR = new Rectangle(100, 100, 1500, 300);
         iconR = new Rectangle(0, 0, 0, 0);
         textR = new Rectangle(0, 0, 0, 0);
-        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                CENTER, CENTER, TOP, RIGHT, viewR, iconR, textR, 30);
-        assertEquals("clipped string ", "Long enough text for this label, can you see th...", clippedStr);
+        clippedStr = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon, CENTER,
+                CENTER, TOP, RIGHT, viewR, iconR, textR, 30);
+        assertEquals("clipped string ", "Long enough text for this label, can you see th...",
+                clippedStr);
         assertEquals("icon rectangle ", new Rectangle(109, 207, 52, 64), iconR);
         assertEquals("text rectangle ", new Rectangle(191, 207, 1400, 86), textR);
-
         if (isHarmony()) {
             Rectangle iconR2 = new Rectangle();
             Rectangle textR2 = new Rectangle();
-            String clippedStr2 = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
-                    CENTER, LEADING, TOP, TRAILING, viewR, iconR2, textR2, 30);
+            String clippedStr2 = SwingUtilities.layoutCompoundLabel(metrics, initialString,
+                    icon, CENTER, LEADING, TOP, TRAILING, viewR, iconR2, textR2, 30);
             assertEquals(clippedStr, clippedStr2);
             assertEquals(iconR, iconR2);
             assertEquals(textR, textR2);
-
             clippedStr2 = SwingUtilities.layoutCompoundLabel(metrics, initialString, icon,
                     CENTER, TRAILING, TOP, LEADING, viewR, iconR2, textR2, 30);
             assertEquals(clippedStr, clippedStr2);
             assertEquals(iconR, iconR2);
             assertEquals(textR, textR2);
         }
-
     }
 
     public void testNotifyAction() {
         class NATestAction implements Action {
             public boolean enabled = true;
+
             protected ActionEvent eventHappened = null;
+
             public Object valueSaved = null;
 
             public void actionPerformed(final ActionEvent event) {
@@ -340,56 +299,59 @@
                     valueSaved = value;
                 }
             }
-        };
-
+        }
+        ;
         NATestAction action = new NATestAction();
         JComponent source = new JPanel();
         int modifiers = InputEvent.CTRL_DOWN_MASK;
         KeyEvent event = new KeyEvent(source, 0, 0, modifiers, KeyEvent.VK_CUT, 'a');
         boolean result = false;
         try {
-            SwingUtilities.notifyAction(null, KeyStroke.getKeyStroke('a'), event, this, modifiers);
-        } catch (NullPointerException e){
+            SwingUtilities.notifyAction(null, KeyStroke.getKeyStroke('a'), event, this,
+                    modifiers);
+        } catch (NullPointerException e) {
             fail("NPE should not be thrown");
         }
-
-        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this, modifiers);
+        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this,
+                modifiers);
         assertTrue(action.eventHappened != null);
         assertFalse(event.isConsumed());
         assertTrue(result);
-
         action.setEnabled(false);
         action.eventHappened = null;
-        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this, modifiers);
+        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this,
+                modifiers);
         assertFalse(result);
         assertFalse(event.isConsumed());
         assertNull(action.eventHappened);
-
         action.setEnabled(true);
-        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this, modifiers);
+        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this,
+                modifiers);
         assertTrue(result);
         assertTrue(action.eventHappened != null);
         assertFalse(event.isConsumed());
         assertTrue(action.eventHappened.getActionCommand().equals("a"));
-
         action.valueSaved = "Yo!";
-        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this, modifiers);
+        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this,
+                modifiers);
         assertTrue(result);
         assertTrue(action.eventHappened != null);
         assertFalse(event.isConsumed());
         assertTrue(action.eventHappened.getActionCommand().equals(action.valueSaved));
-
-        event = new KeyEvent(source, 0, 0, modifiers, KeyEvent.VK_UNDEFINED, KeyEvent.CHAR_UNDEFINED);
+        event = new KeyEvent(source, 0, 0, modifiers, KeyEvent.VK_UNDEFINED,
+                KeyEvent.CHAR_UNDEFINED);
         action.valueSaved = null;
-        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this, modifiers);
+        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this,
+                modifiers);
         assertTrue(result);
         assertFalse(event.isConsumed());
         assertTrue(action.eventHappened != null);
         assertNull(action.eventHappened.getActionCommand());
-
-        event = new KeyEvent(source, 0, 0, modifiers, KeyEvent.VK_UNDEFINED, KeyEvent.CHAR_UNDEFINED);
+        event = new KeyEvent(source, 0, 0, modifiers, KeyEvent.VK_UNDEFINED,
+                KeyEvent.CHAR_UNDEFINED);
         action.setEnabled(false);
-        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this, modifiers);
+        result = SwingUtilities.notifyAction(action, KeyStroke.getKeyStroke('a'), event, this,
+                modifiers);
         assertFalse(result);
         assertFalse(event.isConsumed());
         assertTrue(action.eventHappened != null);
@@ -406,7 +368,6 @@
         panel1.setPreferredSize(new Dimension(100, 100));
         panel2.setPreferredSize(new Dimension(100, 100));
         panel3.setPreferredSize(new Dimension(100, 100));
-
         panel1.add(panel2);
         panel1.setBorder(new EmptyBorder(15, 15, 15, 15));
         window1.getContentPane().add(panel1);
@@ -417,7 +378,6 @@
         window2.setLocation(200, 200);
         window2.pack();
         window2.show();
-
         testExceptionalCase(new NullPointerCase() {
             public void exceptionalAction() throws Exception {
                 SwingUtilities.convertMouseEvent(null, null, null);
@@ -428,7 +388,6 @@
                 SwingUtilities.convertMouseEvent(panel1, null, panel2);
             }
         });
-
         int id = 111;
         int when = 200;
         int x = 0;
@@ -437,54 +396,53 @@
         int modifiers = InputEvent.CTRL_DOWN_MASK;
         boolean isPopupTrigger = false;
         int button = 2;
-        eventBefore = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
-        eventToPass = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
-
+        eventBefore = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
+        eventToPass = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
         final MouseEvent illegalEvent = eventBefore;
         testExceptionalCase(new IllegalArgumentCase() {
             public void exceptionalAction() throws Exception {
                 SwingUtilities.convertMouseEvent(null, illegalEvent, null);
             }
         });
-
-        eventBefore = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
-        eventToPass = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
+        eventBefore = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
+        eventToPass = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
         eventAfter = SwingUtilities.convertMouseEvent(panel1, eventToPass, panel3);
-        assertTrue(eventBefore.getX() == eventToPass.getX() && eventBefore.getY() == eventToPass.getY());
+        assertTrue(eventBefore.getX() == eventToPass.getX()
+                && eventBefore.getY() == eventToPass.getY());
         assertEquals(-100, eventAfter.getX());
         assertEquals(-100, eventAfter.getY());
         assertEquals(panel3, eventAfter.getSource());
-
-        eventBefore = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
-        eventToPass = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
+        eventBefore = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
+        eventToPass = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
         eventAfter = SwingUtilities.convertMouseEvent(panel3, eventToPass, panel2);
-        assertTrue(eventBefore.getX() == eventToPass.getX() && eventBefore.getY() == eventToPass.getY());
+        assertTrue(eventBefore.getX() == eventToPass.getX()
+                && eventBefore.getY() == eventToPass.getY());
         assertEquals(100, eventAfter.getX());
         assertEquals(80, eventAfter.getY());
         assertEquals(panel2, eventAfter.getSource());
-
-        eventBefore = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
-        eventToPass = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
+        eventBefore = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
+        eventToPass = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
         eventAfter = SwingUtilities.convertMouseEvent(panel2, eventToPass, null);
-        assertTrue(eventBefore.getX() == eventToPass.getX() && eventBefore.getY() == eventToPass.getY());
+        assertTrue(eventBefore.getX() == eventToPass.getX()
+                && eventBefore.getY() == eventToPass.getY());
         assertEquals(0, eventAfter.getX());
         assertEquals(20, eventAfter.getY());
         assertEquals(panel2, eventAfter.getSource());
-
-        eventBefore = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
-        eventToPass = new MouseEvent(panel1, id, when,
-                                     modifiers, x, y, clickCount, isPopupTrigger, button);
+        eventBefore = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
+        eventToPass = new MouseEvent(panel1, id, when, modifiers, x, y, clickCount,
+                isPopupTrigger, button);
         eventAfter = SwingUtilities.convertMouseEvent(null, eventToPass, panel2);
-        assertTrue(eventBefore.getX() == eventToPass.getX() && eventBefore.getY() == eventToPass.getY());
+        assertTrue(eventBefore.getX() == eventToPass.getX()
+                && eventBefore.getY() == eventToPass.getY());
         assertEquals(0, eventAfter.getX());
         assertEquals(-20, eventAfter.getY());
         assertEquals(panel2, eventAfter.getSource());
@@ -502,7 +460,6 @@
         panel1.setPreferredSize(new Dimension(100, 100));
         panel2.setPreferredSize(new Dimension(100, 100));
         panel3.setPreferredSize(new Dimension(100, 100));
-
         //panel1.setLocation(50, 50);
         //panel2.setLocation(70, 70);
         //panel3.setLocation(500, 500);
@@ -517,7 +474,6 @@
         window2.setLocation(200, 200);
         window2.pack();
         window2.show();
-
         testExceptionalCase(new NullPointerCase() {
             public void exceptionalAction() throws Exception {
                 SwingUtilities.convertRectangle(null, null, null);
@@ -528,34 +484,29 @@
                 SwingUtilities.convertRectangle(panel1, null, panel2);
             }
         });
-
         rectBefore = new Rectangle(0, 0, width, height);
         rectToPass = new Rectangle(rectBefore);
         rectAfter = SwingUtilities.convertRectangle(null, rectBefore, null);
         assertEquals(rectBefore, rectAfter);
         assertEquals(rectBefore, rectToPass);
-
         rectBefore = new Rectangle(0, 0, width, height);
         rectToPass = new Rectangle(rectBefore);
         rectAfter = SwingUtilities.convertRectangle(panel1, rectToPass, panel3);
         assertEquals(rectBefore, rectToPass);
         assertFalse(rectAfter.equals(rectBefore));
         assertEquals(rectAfter, new Rectangle(-100, -100, width, height));
-
         rectBefore = new Rectangle(0, 0, width, height);
         rectToPass = new Rectangle(rectBefore);
         rectAfter = SwingUtilities.convertRectangle(panel3, rectToPass, panel2);
         assertEquals(rectBefore, rectToPass);
         assertFalse(rectAfter.equals(rectBefore));
         assertEquals(new Rectangle(100, 80, width, height), rectAfter);
-
         rectBefore = new Rectangle(0, 0, width, height);
         rectToPass = new Rectangle(rectBefore);
         rectAfter = SwingUtilities.convertRectangle(panel2, rectToPass, null);
         assertEquals(rectBefore, rectToPass);
         assertFalse(rectAfter.equals(rectBefore));
         assertEquals(new Rectangle(0, 20, width, height), rectAfter);
-
         rectBefore = new Rectangle(0, 0, width, height);
         rectToPass = new Rectangle(rectBefore);
         rectAfter = SwingUtilities.convertRectangle(null, rectToPass, panel2);
@@ -584,7 +535,6 @@
         panel1.setPreferredSize(new Dimension(150, 150));
         panel2.setPreferredSize(new Dimension(100, 100));
         panel3.setPreferredSize(new Dimension(100, 100));
-
         panel1.add(panel2);
         panel1.setBorder(new EmptyBorder(15, 15, 15, 15));
         panel2.setBorder(new EmptyBorder(25, 25, 25, 25));
@@ -597,42 +547,36 @@
         window2.setLocation(200, 200);
         window2.pack();
         window2.show();
-
         pointAfter = new Point(1, 1);
         try {
             pointAfter = SwingUtilities.convertPoint(null, null, null);
-        } catch(NullPointerException e) {
+        } catch (NullPointerException e) {
             fail("NPE should not be thrown");
         }
         assertNull(pointAfter);
-
         pointBefore = new Point(0, 0);
         pointToPass = new Point(pointBefore);
         pointAfter = SwingUtilities.convertPoint(null, pointBefore, null);
         assertTrue(pointBefore.equals(pointAfter));
         assertTrue(pointBefore.equals(pointToPass));
-
         pointBefore = new Point(0, 0);
         pointToPass = new Point(pointBefore);
         pointAfter = SwingUtilities.convertPoint(panel1, pointToPass, panel3);
         assertTrue(pointBefore.equals(pointToPass));
         assertFalse(pointAfter.equals(pointBefore));
         assertTrue(pointAfter.equals(new Point(-100, -100)));
-
         pointBefore = new Point(0, 0);
         pointToPass = new Point(pointBefore);
         pointAfter = SwingUtilities.convertPoint(panel3, pointToPass, panel2);
         assertEquals(pointBefore, pointToPass);
         assertFalse(pointAfter.equals(pointBefore));
         assertEquals(new Point(75, 80), pointAfter);
-
         pointBefore = new Point(0, 0);
         pointToPass = new Point(pointBefore);
         pointAfter = SwingUtilities.convertPoint(panel2, pointToPass, null);
         assertEquals(pointBefore, pointToPass);
         assertFalse(pointAfter.equals(pointBefore));
         assertEquals(new Point(25, 20), pointAfter);
-
         pointBefore = new Point(0, 0);
         pointToPass = new Point(pointBefore);
         pointAfter = SwingUtilities.convertPoint(null, pointToPass, panel2);
@@ -644,70 +588,70 @@
     public void testGetAccessibleAt() {
         // TODO uncomment when Accessibility is implemented
         /*
-        class JComponentInaccessible extends JComponent {
-            public String getUIClassID() {
-                return "PanelUI";
-            }
-            public void updateUI() {
-                setUI((PanelUI)UIManager.getUI(this));
-            }
-            public JComponentInaccessible() {
-                setDoubleBuffered(true);
-                setOpaque(true);
-            }
-        };
-        JComponentInaccessible inaccessible = new JComponentInaccessible();
-        Point checkPoint = null;
-        JWindow window1 = new JWindow();
-        JComponent panel1 = new JPanel();
-        JComponent panel2 = new JPanel();
-        JComponent panel3 = new JPanel();
-        panel1.setBackground(Color.GREEN);
-        panel2.setPreferredSize(new Dimension(101, 101));
-        panel2.setBackground(Color.YELLOW);
-        panel3.setPreferredSize(new Dimension(110, 110));
-        panel3.setBackground(Color.WHITE);
-        inaccessible.setBackground(Color.RED);
-        inaccessible.setForeground(Color.RED);
-
-        inaccessible.setPreferredSize(new Dimension(51, 51));
-
-        panel1.add(panel3);
-        panel1.add(panel2);
-        panel1.add(inaccessible);
-        panel1.setBorder(new EmptyBorder(15, 15, 15, 15));
-        panel2.setBorder(new EmptyBorder(26, 26, 26, 26));
-        panel3.setBorder(new EmptyBorder(37, 37, 37, 37));
-        window1.getContentPane().add(panel1);
-        window1.pack();
-        window1.show();
-        window1.hide();
-        window1.show();
-
-        boolean thrown = false;
-        try {
-            SwingUtilities.getAccessibleAt(null, checkPoint);
-        } catch (NullPointerException e) {
-            thrown = true;
-        }
-        assertFalse(thrown);
-        thrown = false;
-        try {
-          SwingUtilities.getAccessibleAt(panel1, null);
-        } catch (NullPointerException e) {
-            thrown = true;
-        }
-        assertTrue(thrown);
-
-        checkPoint = SwingUtilities.convertPoint(panel2, 5, 5, panel1);
-        assertEquals(panel1, SwingUtilities.getAccessibleAt(panel1, checkPoint));
-
-        checkPoint = SwingUtilities.convertPoint(panel3, 5, 5, panel1);
-        assertEquals(panel3, SwingUtilities.getAccessibleAt(panel1, checkPoint));
-
-        checkPoint = SwingUtilities.convertPoint(inaccessible, 5, 5, panel1);
-        assertEquals(panel1, SwingUtilities.getAccessibleAt(panel1, checkPoint));
-        */
+         class JComponentInaccessible extends JComponent {
+         public String getUIClassID() {
+         return "PanelUI";
+         }
+         public void updateUI() {
+         setUI((PanelUI)UIManager.getUI(this));
+         }
+         public JComponentInaccessible() {
+         setDoubleBuffered(true);
+         setOpaque(true);
+         }
+         };
+         JComponentInaccessible inaccessible = new JComponentInaccessible();
+         Point checkPoint = null;
+         JWindow window1 = new JWindow();
+         JComponent panel1 = new JPanel();
+         JComponent panel2 = new JPanel();
+         JComponent panel3 = new JPanel();
+         panel1.setBackground(Color.GREEN);
+         panel2.setPreferredSize(new Dimension(101, 101));
+         panel2.setBackground(Color.YELLOW);
+         panel3.setPreferredSize(new Dimension(110, 110));
+         panel3.setBackground(Color.WHITE);
+         inaccessible.setBackground(Color.RED);
+         inaccessible.setForeground(Color.RED);
+
+         inaccessible.setPreferredSize(new Dimension(51, 51));
+
+         panel1.add(panel3);
+         panel1.add(panel2);
+         panel1.add(inaccessible);
+         panel1.setBorder(new EmptyBorder(15, 15, 15, 15));
+         panel2.setBorder(new EmptyBorder(26, 26, 26, 26));
+         panel3.setBorder(new EmptyBorder(37, 37, 37, 37));
+         window1.getContentPane().add(panel1);
+         window1.pack();
+         window1.show();
+         window1.hide();
+         window1.show();
+
+         boolean thrown = false;
+         try {
+         SwingUtilities.getAccessibleAt(null, checkPoint);
+         } catch (NullPointerException e) {
+         thrown = true;
+         }
+         assertFalse(thrown);
+         thrown = false;
+         try {
+         SwingUtilities.getAccessibleAt(panel1, null);
+         } catch (NullPointerException e) {
+         thrown = true;
+         }
+         assertTrue(thrown);
+
+         checkPoint = SwingUtilities.convertPoint(panel2, 5, 5, panel1);
+         assertEquals(panel1, SwingUtilities.getAccessibleAt(panel1, checkPoint));
+
+         checkPoint = SwingUtilities.convertPoint(panel3, 5, 5, panel1);
+         assertEquals(panel3, SwingUtilities.getAccessibleAt(panel1, checkPoint));
+
+         checkPoint = SwingUtilities.convertPoint(inaccessible, 5, 5, panel1);
+         assertEquals(panel1, SwingUtilities.getAccessibleAt(panel1, checkPoint));
+         */
     }
 
     public void testCalculateInnerArea() {
@@ -722,7 +666,6 @@
         Rectangle rect1 = new Rectangle(20, 10, 260, 110);
         Rectangle rect2 = new Rectangle(0, 0, 100, 100);
         Rectangle rect3 = new Rectangle(0, 0, 50, 50);
-
         panel1.setBorder(new EmptyBorder(10, 20, 30, 40));
         panel2.setPreferredSize(new Dimension(100, 100));
         component1.setPreferredSize(new Dimension(50, 50));
@@ -737,7 +680,6 @@
         window.pack();
         assertNull(SwingUtilities.calculateInnerArea(null, rect));
         assertNull(SwingUtilities.calculateInnerArea(null, null));
-
         assertEquals(rect2, SwingUtilities.calculateInnerArea(panel2, rect));
         assertEquals(rect2, SwingUtilities.calculateInnerArea(panel2, rect));
         assertEquals(rect3, SwingUtilities.calculateInnerArea(component1, rect));
@@ -755,27 +697,21 @@
                 }
             }
         }
-
         return false;
     }
 
     public void testComputeDifference() {
         Rectangle rect11 = new Rectangle(0, 0, 300, 300);
         Rectangle rect12 = new Rectangle(100, 100, 100, 100);
-
         // different null testcases
         Rectangle rects[] = null;
-
         rects = SwingUtilities.computeDifference(rect12, null);
         assertTrue(rects != null && rects.length == 0);
-
         rects = SwingUtilities.computeDifference(null, null);
         assertTrue(rects != null && rects.length == 0);
-
         // real recatangles testcases
         rects = SwingUtilities.computeDifference(rect12, rect11);
         assertTrue(rects != null && rects.length == 0);
-
         rects = SwingUtilities.computeDifference(rect11, rect12);
         assertTrue(rects != null && rects.length == 4);
         assertTrue(contains(rects, new Point(0, 0)));
@@ -787,12 +723,10 @@
         assertTrue(contains(rects, new Point(220, 0)));
         assertTrue(contains(rects, new Point(210, 150)));
         assertTrue(contains(rects, new Point(210, 280)));
-
         Rectangle rect21 = new Rectangle(0, 0, 300, 300);
         Rectangle rect22 = new Rectangle(0, 310, 300, 300);
         rects = SwingUtilities.computeDifference(rect21, rect22);
         assertTrue(rects != null && (rects.length == 0));
-
         Rectangle rect31 = new Rectangle(100, 100, 100, 100);
         Rectangle rect32 = new Rectangle(50, 50, 100, 100);
         rects = SwingUtilities.computeDifference(rect31, rect32);
@@ -806,7 +740,6 @@
         assertFalse(contains(rects, new Point(160, 60)));
         assertTrue(contains(rects, new Point(160, 140)));
         assertTrue(contains(rects, new Point(160, 190)));
-
         Rectangle rect41 = new Rectangle(50, 50, 100, 100);
         Rectangle rect42 = new Rectangle(100, 100, 100, 100);
         rects = SwingUtilities.computeDifference(rect41, rect42);
@@ -842,18 +775,15 @@
         Component component2 = new JPanel();
         Component component3 = new JPanel();
         JPanel panel4 = new JPanel();
-
         assertNull(SwingUtilities.getAncestorNamed(name1, null));
         assertNull(SwingUtilities.getAncestorNamed(null, component3));
         assertNull(SwingUtilities.getAncestorNamed(null, null));
-
         panel4.add(panel1);
         panel1.add(panel2);
         panel2.add(component1);
         panel3.add(component3);
         window.add(panel4);
         window.add(component2);
-
         assertTrue(SwingUtilities.getAncestorNamed(name3, component1) == panel1);
         assertNull(SwingUtilities.getAncestorNamed(name6, component1));
         assertTrue(SwingUtilities.getAncestorNamed(name2, component1) == window);
@@ -872,30 +802,25 @@
         Component component1 = new Canvas();
         Component component2 = new Panel();
         Component component3 = new Panel();
-
         assertNull(SwingUtilities.getAncestorOfClass(JPanel.class, null));
         assertNull(SwingUtilities.getAncestorOfClass(null, component3));
         assertNull(SwingUtilities.getAncestorOfClass(null, null));
-
         panel1.add(panel2);
         panel2.add(component1);
         panel3.add(component3);
         window.add(panel1);
         window.add(component2);
-
         assertTrue(SwingUtilities.getAncestorOfClass(Window.class, component1) == window);
         assertTrue(SwingUtilities.getAncestorOfClass(JPanel.class, component1) == panel2);
         assertTrue(SwingUtilities.getAncestorOfClass(JPanel.class, panel2) == panel1);
         assertTrue(SwingUtilities.getAncestorOfClass(Window.class, component2) == window);
         assertNull(SwingUtilities.getAncestorOfClass(Window.class, component3));
         assertTrue(SwingUtilities.getAncestorOfClass(JPanel.class, component3) == panel3);
-
         class CustomPanel extends JPanel {
         }
         JPanel customPanel = new CustomPanel();
         JPanel childPanel = new JPanel();
         customPanel.add(childPanel);
-
         assertTrue(SwingUtilities.getAncestorOfClass(JPanel.class, childPanel) == customPanel);
     }
 
@@ -909,28 +834,27 @@
      * Class under test for void paintComponent(Graphics, Component, Container, int, int, int, int)
      */
     public void testPaintComponentGraphicsComponentContainerintintintint() {
-//        final JComponent component = new JButton("JButton");
-//        JFrame window = new JFrame() {
-//            public void paint(Graphics g) {
-//                SwingUtilities.paintComponent(g, component, new Container(), 25, 25, 50, 50);
-//            }
-//        };
-//        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-//        window.setSize(150, 150);
-//        window.show();
-//        component.setPreferredSize(new Dimension(70, 70));
-//        component.setForeground(Color.RED);
-//        component.setBackground(Color.YELLOW);
-//        JPanel panel =  new JPanel();
-//        window.getContentPane().add(panel);
-//        while (!window.isActive());
-//        while (window.isActive());
+        //        final JComponent component = new JButton("JButton");
+        //        JFrame window = new JFrame() {
+        //            public void paint(Graphics g) {
+        //                SwingUtilities.paintComponent(g, component, new Container(), 25, 25, 50, 50);
+        //            }
+        //        };
+        //        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        //        window.setSize(150, 150);
+        //        window.show();
+        //        component.setPreferredSize(new Dimension(70, 70));
+        //        component.setForeground(Color.RED);
+        //        component.setBackground(Color.YELLOW);
+        //        JPanel panel =  new JPanel();
+        //        window.getContentPane().add(panel);
+        //        while (!window.isActive());
+        //        while (window.isActive());
     }
 
     public void testGetRootPane() {
         assertNull(SwingUtilities.getRootPane(null));
         assertNull(SwingUtilities.getRootPane(new JButton()));
-
         JWindow window = new JWindow(new Frame());
         JPanel panel1 = new JPanel();
         JPanel panel2 = new JPanel();
@@ -944,7 +868,6 @@
         panel3.add(component3);
         window.getContentPane().add(panel1);
         window.getContentPane().add(component2);
-
         assertEquals(window.getRootPane(), SwingUtilities.getRootPane(component1));
         assertNull(SwingUtilities.getRootPane(component3));
         assertEquals(window.getRootPane(), SwingUtilities.getRootPane(component2));
@@ -958,24 +881,25 @@
         JComponent component = new JPanel();
         InputMap initialMap = component.getInputMap(JComponent.WHEN_FOCUSED);
         InputMap anotherMap = new InputMap();
-
         component.setInputMap(JComponent.WHEN_FOCUSED, null);
         component.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
         assertNull(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED));
         SwingUtilities.replaceUIInputMap(component, JComponent.WHEN_FOCUSED, uiInputMap1);
-        SwingUtilities.replaceUIInputMap(component, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, uiInputMap2);
+        SwingUtilities.replaceUIInputMap(component,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, uiInputMap2);
         assertNull(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED));
-        assertNull(SwingUtilities.getUIInputMap(component, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));
-
+        assertNull(SwingUtilities.getUIInputMap(component,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));
         component.setInputMap(JComponent.WHEN_FOCUSED, initialMap);
         component.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, anotherMap);
         SwingUtilities.replaceUIInputMap(component, JComponent.WHEN_FOCUSED, uiInputMap1);
         assertTrue(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED) == uiInputMap1);
         SwingUtilities.replaceUIInputMap(component, JComponent.WHEN_FOCUSED, uiInputMap2);
         assertTrue(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED) == uiInputMap2);
-        SwingUtilities.replaceUIInputMap(component, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, uiInputMap2);
-        assertTrue(SwingUtilities.getUIInputMap(component, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) == uiInputMap2);
-
+        SwingUtilities.replaceUIInputMap(component,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, uiInputMap2);
+        assertTrue(SwingUtilities.getUIInputMap(component,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) == uiInputMap2);
         anotherMap.setParent(null);
         initialMap.setParent(anotherMap);
         assertNull(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED));
@@ -989,10 +913,10 @@
         JComponent component = new JPanel();
         InputMap initialMap = component.getInputMap();
         InputMap anotherMap = new InputMap();
-
         component.setInputMap(JComponent.WHEN_FOCUSED, null);
         assertNull(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED));
-        assertNull(SwingUtilities.getUIInputMap(component, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));
+        assertNull(SwingUtilities.getUIInputMap(component,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));
         component.setInputMap(JComponent.WHEN_FOCUSED, uiInputMap1);
         assertNull(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED));
         component.setInputMap(JComponent.WHEN_FOCUSED, anotherMap);
@@ -1002,11 +926,12 @@
         assertNull(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED));
         anotherMap.setParent(uiInputMap1);
         assertTrue(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED) == uiInputMap1);
-        assertTrue(SwingUtilities.getUIInputMap(component, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) == uiInputMap1);
+        assertTrue(SwingUtilities.getUIInputMap(component,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) == uiInputMap1);
         uiInputMap1.setParent(uiInputMap2);
         assertTrue(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED) == uiInputMap1);
-        assertTrue(SwingUtilities.getUIInputMap(component, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) == uiInputMap1);
-
+        assertTrue(SwingUtilities.getUIInputMap(component,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) == uiInputMap1);
         anotherMap.setParent(initialMap);
         initialMap.setParent(uiInputMap1);
         assertTrue(SwingUtilities.getUIInputMap(component, JComponent.WHEN_FOCUSED) == uiInputMap1);
@@ -1020,18 +945,15 @@
         JComponent component = new JPanel();
         ActionMap initialMap = component.getActionMap();
         ActionMap anotherMap = new ActionMap();
-
         component.setActionMap(null);
         assertNull(SwingUtilities.getUIActionMap(component));
         SwingUtilities.replaceUIActionMap(component, uiActionMap1);
         assertNull(SwingUtilities.getUIActionMap(component));
-
         component.setActionMap(initialMap);
         SwingUtilities.replaceUIActionMap(component, uiActionMap1);
         assertTrue(SwingUtilities.getUIActionMap(component) == uiActionMap1);
         SwingUtilities.replaceUIActionMap(component, uiActionMap2);
         assertTrue(SwingUtilities.getUIActionMap(component) == uiActionMap2);
-
         initialMap.setParent(anotherMap);
         assertNull(SwingUtilities.getUIActionMap(component));
         SwingUtilities.replaceUIActionMap(component, uiActionMap2);
@@ -1044,7 +966,6 @@
         JComponent component = new JPanel();
         ActionMap initialMap = component.getActionMap();
         ActionMap anotherMap = new ActionMap();
-
         component.setActionMap(null);
         assertNull(SwingUtilities.getUIActionMap(component));
         component.setActionMap(uiActionMap1);
@@ -1057,7 +978,6 @@
         assertTrue(SwingUtilities.getUIActionMap(component) == uiActionMap1);
         uiActionMap1.setParent(uiActionMap2);
         assertTrue(SwingUtilities.getUIActionMap(component) == uiActionMap1);
-
         anotherMap.setParent(initialMap);
         initialMap.setParent(uiActionMap1);
         assertTrue(SwingUtilities.getUIActionMap(component) == uiActionMap1);
@@ -1067,42 +987,38 @@
 
     public void testGetAccessibleStateSet() {
         Component component1 = new JPanel();
-        Component component3  = new JDialog();
+        Component component3 = new JDialog();
         AccessibleStateSet stateSet = SwingUtilities.getAccessibleStateSet(component1);
         assertTrue(stateSet.contains(AccessibleState.ENABLED));
         assertTrue(stateSet.contains(AccessibleState.FOCUSABLE));
         assertTrue(stateSet.contains(AccessibleState.VISIBLE));
         assertTrue(stateSet.contains(AccessibleState.OPAQUE));
         assertTrue(stateSet.toArray().length == 4);
-
         stateSet = SwingUtilities.getAccessibleStateSet(component3);
         assertTrue(stateSet.contains(AccessibleState.ENABLED));
         assertTrue(stateSet.contains(AccessibleState.FOCUSABLE));
         assertTrue(stateSet.contains(AccessibleState.RESIZABLE));
-//        assertTrue(stateSet.toArray().length == 3);
+        //        assertTrue(stateSet.toArray().length == 3);
     }
 
     public void testGetAccessibleChild() {
         assertTrue(SwingUtilities.getAccessibleIndexInParent(new JButton()) == -1);
         JPanel panel = new JPanel();
         assertTrue(SwingUtilities.getAccessibleIndexInParent(panel) == -1);
-
         Component component1 = new JPanel();
         panel.add(component1);
-        assertTrue("Accessible component found in parent",
-                SwingUtilities.getAccessibleChild(panel, 0) == component1);
-
+        assertTrue("Accessible component found in parent", SwingUtilities.getAccessibleChild(
+                panel, 0) == component1);
         Component component2 = new Container();
         panel.add(component2);
-        assertNull("inAccessible component not found in parent",
-                SwingUtilities.getAccessibleChild(panel, 1));
-
-        Component component3  = new JPanel();
+        assertNull("inAccessible component not found in parent", SwingUtilities
+                .getAccessibleChild(panel, 1));
+        Component component3 = new JPanel();
         panel.add(component3);
-        assertTrue("Accessible component found in parent",
-                SwingUtilities.getAccessibleChild(panel, 1) == component3);
-        assertTrue("Accessible component found in parent",
-                SwingUtilities.getAccessibleChild(panel, 0) == component1);
+        assertTrue("Accessible component found in parent", SwingUtilities.getAccessibleChild(
+                panel, 1) == component3);
+        assertTrue("Accessible component found in parent", SwingUtilities.getAccessibleChild(
+                panel, 0) == component1);
     }
 
     public void testComputeStringWidth() {
@@ -1110,11 +1026,10 @@
         JWindow window = new JWindow(frame);
         window.setVisible(true);
         final FontMetrics metrics = window.getGraphics().getFontMetrics();
-//        String string1 = "string1";
-//        String string2 = "string1string1";
-//        String string3 = "";
-//        String string4 = "    ";
-
+        //        String string1 = "string1";
+        //        String string2 = "string1string1";
+        //        String string3 = "";
+        //        String string4 = "    ";
         testExceptionalCase(new NullPointerCase() {
             public void exceptionalAction() throws Exception {
                 SwingUtilities.computeStringWidth(metrics, null);
@@ -1125,13 +1040,12 @@
                 SwingUtilities.computeStringWidth(null, "string");
             }
         });
-
-//        assertTrue(SwingUtilities.computeStringWidth(metrics, string1) == 38);
-//        assertTrue(SwingUtilities.computeStringWidth(metrics, string2) == 76);
-//        assertTrue(SwingUtilities.computeStringWidth(metrics, string3) == 0);
-//        assertTrue(SwingUtilities.computeStringWidth(metrics, string4) == 12);
+        //        assertTrue(SwingUtilities.computeStringWidth(metrics, string1) == 38);
+        //        assertTrue(SwingUtilities.computeStringWidth(metrics, string2) == 76);
+        //        assertTrue(SwingUtilities.computeStringWidth(metrics, string3) == 0);
+        //        assertTrue(SwingUtilities.computeStringWidth(metrics, string4) == 12);
         frame.dispose();
-      }
+    }
 
     public void testWindowForComponent() {
         Window window = new Window(new Frame());
@@ -1141,15 +1055,12 @@
         Component component1 = new Button();
         Component component2 = new JButton();
         Component component3 = new JButton();
-
         assertNull(SwingUtilities.windowForComponent(component1));
-
         panel1.add(panel2);
         panel2.add(component1);
         panel3.add(component3);
         window.add(panel1);
         window.add(component2);
-
         assertTrue(SwingUtilities.windowForComponent(component1) == window);
         assertTrue(SwingUtilities.windowForComponent(component2) == window);
         assertNull(SwingUtilities.windowForComponent(component3));
@@ -1165,22 +1076,20 @@
         Component component2 = new JButton();
         Component component3 = new JButton();
         /**
-        boolean thrown = false;
-        try {
-            SwingUtilities.getWindowAncestor(null);
-        } catch (NullPointerException e) {
-            thrown = true;
-        }
-        assertTrue(thrown);
-        */
+         boolean thrown = false;
+         try {
+         SwingUtilities.getWindowAncestor(null);
+         } catch (NullPointerException e) {
+         thrown = true;
+         }
+         assertTrue(thrown);
+         */
         assertNull(SwingUtilities.getWindowAncestor(component1));
-
         panel1.add(panel2);
         panel2.add(component1);
         panel3.add(component3);
         window.add(panel1);
         window.add(component2);
-
         assertTrue(SwingUtilities.getWindowAncestor(component1) == window);
         assertTrue(SwingUtilities.getWindowAncestor(component2) == window);
         assertNull(SwingUtilities.getWindowAncestor(component3));
@@ -1193,7 +1102,6 @@
         Rectangle rect3 = new Rectangle(150, 150, 50, 50);
         Rectangle rect4 = new Rectangle(0, 0, 150, 150);
         Rectangle rect5 = new Rectangle(100, 100, 1, 1);
-
         assertTrue(SwingUtilities.isRectangleContainingRectangle(rect1, rect2));
         assertTrue(SwingUtilities.isRectangleContainingRectangle(rect1, rect5));
         assertFalse(SwingUtilities.isRectangleContainingRectangle(rect2, rect1));
@@ -1207,69 +1115,47 @@
     public void testComputeUnion() {
         assertTrue(SwingUtilities.computeUnion(0, 0, 100, 100,
                 new Rectangle(100, 100, 100, 100)).equals(new Rectangle(0, 0, 200, 200)));
-
         assertTrue(SwingUtilities.computeUnion(100, 100, 100, 100,
                 new Rectangle(0, 0, 100, 100)).equals(new Rectangle(0, 0, 200, 200)));
-
         assertTrue(SwingUtilities.computeUnion(0, 0, 100, 100,
                 new Rectangle(200, 200, 100, 100)).equals(new Rectangle(0, 0, 300, 300)));
-
         assertTrue(SwingUtilities.computeUnion(200, 200, 100, 100,
                 new Rectangle(0, 0, 100, 100)).equals(new Rectangle(0, 0, 300, 300)));
-
         assertTrue(SwingUtilities.computeUnion(200, 200, 100, 100,
                 new Rectangle(220, 220, 10, 10)).equals(new Rectangle(200, 200, 100, 100)));
-
         assertTrue(SwingUtilities.computeUnion(200, 200, 100, 100,
                 new Rectangle(180, 220, 10, 100)).equals(new Rectangle(180, 200, 120, 120)));
     }
 
     public void testComputeIntersection() {
-        assertEquals(new Dimension(0, 0),
-                SwingUtilities.computeIntersection(0, 0, 100, 100,
+        assertEquals(new Dimension(0, 0), SwingUtilities.computeIntersection(0, 0, 100, 100,
                 new Rectangle(100, 100, 100, 100)).getSize());
-
-        assertEquals(new Rectangle(150, 150, 20, 20),
-                SwingUtilities.computeIntersection(100, 100, 100, 100,
-                new Rectangle(150, 150, 20, 20)));
-
-        assertEquals(new Rectangle(150, 150, 20, 20),
-                SwingUtilities.computeIntersection(150, 150, 20, 20,
-                new Rectangle(100, 100, 100, 100)));
-
-        assertEquals(new Rectangle(0, 0, 0, 0),
-                SwingUtilities.computeIntersection(0, 0, 100, 100,
-                new Rectangle(200, 200, 100, 100)));
-
-        assertEquals(new Rectangle(0, 0, 0, 0),
-                     SwingUtilities.computeIntersection(0, 0, 100, 100,
-                     new Rectangle(0, 101, 100, 100)));
-
-        assertEquals(new Rectangle(0, 0, 0, 0),
-                     SwingUtilities.computeIntersection(0, 0, 100, 100,
-                     new Rectangle(101, 0, 100, 100)));
-
-        assertEquals(new Rectangle(200, 200, 50, 50),
-                SwingUtilities.computeIntersection(200, 200, 100, 100,
-                new Rectangle(150, 150, 100, 100)));
-
-        assertEquals(new Rectangle(200, 200, 50, 50),
-                SwingUtilities.computeIntersection(150, 150, 100, 100,
-                new Rectangle(200, 200, 100, 100)));
+        assertEquals(new Rectangle(150, 150, 20, 20), SwingUtilities.computeIntersection(100,
+                100, 100, 100, new Rectangle(150, 150, 20, 20)));
+        assertEquals(new Rectangle(150, 150, 20, 20), SwingUtilities.computeIntersection(150,
+                150, 20, 20, new Rectangle(100, 100, 100, 100)));
+        assertEquals(new Rectangle(0, 0, 0, 0), SwingUtilities.computeIntersection(0, 0, 100,
+                100, new Rectangle(200, 200, 100, 100)));
+        assertEquals(new Rectangle(0, 0, 0, 0), SwingUtilities.computeIntersection(0, 0, 100,
+                100, new Rectangle(0, 101, 100, 100)));
+        assertEquals(new Rectangle(0, 0, 0, 0), SwingUtilities.computeIntersection(0, 0, 100,
+                100, new Rectangle(101, 0, 100, 100)));
+        assertEquals(new Rectangle(200, 200, 50, 50), SwingUtilities.computeIntersection(200,
+                200, 100, 100, new Rectangle(150, 150, 100, 100)));
+        assertEquals(new Rectangle(200, 200, 50, 50), SwingUtilities.computeIntersection(150,
+                150, 100, 100, new Rectangle(200, 200, 100, 100)));
     }
 
     public void testGetLocalBounds() {
         int width = 200;
         int height = 200;
         Component component = new JPanel();
-
         component.setSize(width, height);
         Rectangle bounds = SwingUtilities.getLocalBounds(component);
         assertTrue(bounds.x == 0);
         assertTrue(bounds.y == 0);
         assertTrue(bounds.width == width);
         assertTrue(bounds.height == height);
-
         component.setBounds(width, height, width, height);
         bounds = SwingUtilities.getLocalBounds(component);
         assertTrue(bounds.x == 0);
@@ -1287,15 +1173,12 @@
         panel1.add(panel2);
         panel2.setSize(200, 200);
         panel2.setLocation(70, 70);
-
         point = new Point(0, 0);
         SwingUtilities.convertPointToScreen(point, panel1);
         assertTrue(point.equals(new Point(50, 50)));
-
         point = new Point(0, 0);
         SwingUtilities.convertPointToScreen(point, panel2);
         assertTrue(point.equals(new Point(120, 120)));
-
         point = new Point(66, 66);
         SwingUtilities.convertPointToScreen(point, panel2);
         assertTrue(point.equals(new Point(186, 186)));
@@ -1310,15 +1193,12 @@
         panel1.add(panel2);
         panel2.setSize(200, 200);
         panel2.setLocation(70, 70);
-
         point = new Point(50, 50);
         SwingUtilities.convertPointFromScreen(point, panel1);
         assertTrue(point.equals(new Point(0, 0)));
-
         point = new Point(120, 120);
         SwingUtilities.convertPointFromScreen(point, panel2);
         assertTrue(point.equals(new Point(0, 0)));
-
         point = new Point(186, 186);
         SwingUtilities.convertPointFromScreen(point, panel2);
         assertTrue(point.equals(new Point(66, 66)));
@@ -1332,23 +1212,19 @@
         Component component1 = new Button();
         Component component2 = new JButton();
         Component component3 = new JButton();
-
         panel1.add(panel2);
         panel2.add(component1);
         panel3.add(component3);
         window.add(panel1);
         window.add(component2);
-
         assertTrue(SwingUtilities.isDescendingFrom(null, null));
         testExceptionalCase(new NullPointerCase() {
             public void exceptionalAction() throws Exception {
                 SwingUtilities.isDescendingFrom(null, window);
             }
         });
-
         assertFalse(SwingUtilities.isDescendingFrom(component1, null));
         assertTrue(SwingUtilities.isDescendingFrom(window, window));
-
         assertTrue(SwingUtilities.isDescendingFrom(component1, window));
         assertTrue(SwingUtilities.isDescendingFrom(component2, window));
         assertFalse(SwingUtilities.isDescendingFrom(component3, window));
@@ -1367,7 +1243,6 @@
         Component component1 = new JButton("1");
         Component component2 = new JButton("2");
         Component component3 = new JButton("3");
-
         panel1.add(panel2);
         panel2.add(component1);
         panel1.add(component3);
@@ -1375,7 +1250,6 @@
         window.getContentPane().add(panel1);
         window.pack();
         window.show();
-
         assertTrue(SwingUtilities.getDeepestComponentAt(window.getContentPane(), 0, 0) == panel1);
         assertTrue(SwingUtilities.getDeepestComponentAt(window.getContentPane(), 5, 5) == panel2);
         assertTrue(SwingUtilities.getDeepestComponentAt(window.getContentPane(), 10, 10) == component1);
@@ -1387,23 +1261,19 @@
 
     public void testGetRoot() {
         JWindow window1 = new JWindow();
-
         // Code should be enabled when JApplet is supported.
         //JApplet window2 = new JApplet();
         JWindow window2 = new JWindow();
-
         JComponent panel1 = new JPanel();
         JComponent panel2 = new JPanel();
         JComponent panel3 = new JPanel();
         JComponent panel4 = new JPanel();
-
         panel1.setSize(new Dimension(100, 100));
         panel1.setBackground(Color.GREEN);
         panel2.setSize(new Dimension(101, 101));
         panel2.setBackground(Color.YELLOW);
         panel3.setPreferredSize(new Dimension(110, 110));
         panel3.setBackground(Color.WHITE);
-
         panel1.setLocation(50, 50);
         panel2.setLocation(70, 70);
         panel3.setLocation(150, 150);
@@ -1414,7 +1284,6 @@
         window1.setLocation(100, 100);
         window1.getContentPane().add(panel1);
         window2.getContentPane().add(panel4);
-
         assertEquals(window1, SwingUtilities.getRoot(panel1));
         assertEquals(window1, SwingUtilities.getRoot(panel2));
         assertNull(SwingUtilities.getRoot(panel3));
@@ -1444,10 +1313,12 @@
     public void testIsRightMouseButton() {
         JComponent panel = new JPanel();
         panel.setPreferredSize(new Dimension(100, 100));
-        MouseEvent event1 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON1_DOWN_MASK, 50, 50, 1, false);
-        MouseEvent event2 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON2_DOWN_MASK, 50, 50, 1, false);
-        MouseEvent event3 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON3_DOWN_MASK, 50, 50, 1, false);
-
+        MouseEvent event1 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON1_DOWN_MASK, 50,
+                50, 1, false);
+        MouseEvent event2 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON2_DOWN_MASK, 50,
+                50, 1, false);
+        MouseEvent event3 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON3_DOWN_MASK, 50,
+                50, 1, false);
         assertFalse(SwingUtilities.isRightMouseButton(event1));
         assertFalse(SwingUtilities.isRightMouseButton(event2));
         assertTrue(SwingUtilities.isRightMouseButton(event3));
@@ -1456,10 +1327,12 @@
     public void testIsMiddleMouseButton() {
         JComponent panel = new JPanel();
         panel.setPreferredSize(new Dimension(100, 100));
-        MouseEvent event1 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON1_DOWN_MASK, 50, 50, 1, false);
-        MouseEvent event2 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON2_DOWN_MASK, 50, 50, 1, false);
-        MouseEvent event3 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON3_DOWN_MASK, 50, 50, 1, false);
-
+        MouseEvent event1 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON1_DOWN_MASK, 50,
+                50, 1, false);
+        MouseEvent event2 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON2_DOWN_MASK, 50,
+                50, 1, false);
+        MouseEvent event3 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON3_DOWN_MASK, 50,
+                50, 1, false);
         assertFalse(SwingUtilities.isMiddleMouseButton(event1));
         assertTrue(SwingUtilities.isMiddleMouseButton(event2));
         assertFalse(SwingUtilities.isMiddleMouseButton(event3));
@@ -1468,10 +1341,12 @@
     public void testIsLeftMouseButton() {
         JComponent panel = new JPanel();
         panel.setPreferredSize(new Dimension(100, 100));
-        MouseEvent event1 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON1_DOWN_MASK, 50, 50, 1, false);
-        MouseEvent event2 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON2_DOWN_MASK, 50, 50, 1, false);
-        MouseEvent event3 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON3_DOWN_MASK, 50, 50, 1, false);
-
+        MouseEvent event1 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON1_DOWN_MASK, 50,
+                50, 1, false);
+        MouseEvent event2 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON2_DOWN_MASK, 50,
+                50, 1, false);
+        MouseEvent event3 = new MouseEvent(panel, 100, 100, MouseEvent.BUTTON3_DOWN_MASK, 50,
+                50, 1, false);
         assertTrue(SwingUtilities.isLeftMouseButton(event1));
         assertFalse(SwingUtilities.isLeftMouseButton(event2));
         assertFalse(SwingUtilities.isLeftMouseButton(event3));
@@ -1480,10 +1355,12 @@
     public void testProcessKeyBindings() {
         class ActionListenerDummy implements ActionListener {
             public ActionEvent event = null;
+
             public void actionPerformed(final ActionEvent e) {
                 event = e;
             }
-        };
+        }
+        ;
         ActionListenerDummy action1 = new ActionListenerDummy();
         ActionListenerDummy action2 = new ActionListenerDummy();
         ActionListenerDummy action3 = new ActionListenerDummy();
@@ -1493,7 +1370,6 @@
         ActionListenerDummy action52 = new ActionListenerDummy();
         ActionListenerDummy action53 = new ActionListenerDummy();
         ActionListenerDummy action54 = new ActionListenerDummy();
-
         JComponent component1 = new JPanel();
         Component component2 = new Panel();
         JComponent component3 = new JButton("3");
@@ -1501,36 +1377,43 @@
         component4.getContentPane().add(component1);
         component1.add(component2);
         component1.add(component3);
-        KeyEvent event1 = new KeyEvent(component1, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_A, 'a');
-        KeyEvent event2 = new KeyEvent(component2, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_B, 'b');
-        KeyEvent event3 = new KeyEvent(component3, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_C, 'c');
-        KeyEvent event4 = new KeyEvent(component2, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_D, 'd');
-        KeyEvent event5 = new KeyEvent(component1, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_ENTER, '\n');
+        KeyEvent event1 = new KeyEvent(component1, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_A,
+                'a');
+        KeyEvent event2 = new KeyEvent(component2, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_B,
+                'b');
+        KeyEvent event3 = new KeyEvent(component3, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_C,
+                'c');
+        KeyEvent event4 = new KeyEvent(component2, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_D,
+                'd');
+        KeyEvent event5 = new KeyEvent(component1, KeyEvent.KEY_PRESSED, 0, 0,
+                KeyEvent.VK_ENTER, '\n');
         KeyStroke keyStroke1 = KeyStroke.getKeyStrokeForEvent(event1);
         KeyStroke keyStroke2 = KeyStroke.getKeyStrokeForEvent(event2);
         KeyStroke keyStroke3 = KeyStroke.getKeyStrokeForEvent(event3);
         KeyStroke keyStroke4 = KeyStroke.getKeyStrokeForEvent(event4);
         KeyStroke keyStroke5 = KeyStroke.getKeyStrokeForEvent(event5);
-
         component1.registerKeyboardAction(action1, keyStroke1, JComponent.WHEN_FOCUSED);
-        component1.registerKeyboardAction(action2, keyStroke2, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-        component3.registerKeyboardAction(action3, keyStroke3, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-        component1.registerKeyboardAction(action41, keyStroke4, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-        component3.registerKeyboardAction(action42, keyStroke4, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        component1.registerKeyboardAction(action2, keyStroke2,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        component3.registerKeyboardAction(action3, keyStroke3,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        component1.registerKeyboardAction(action41, keyStroke4,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        component3.registerKeyboardAction(action42, keyStroke4,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
         component3.registerKeyboardAction(action53, keyStroke5, JComponent.WHEN_FOCUSED);
-        component1.registerKeyboardAction(action51, keyStroke5, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        component1.registerKeyboardAction(action51, keyStroke5,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
         boolean result = SwingUtilities.processKeyBindings(event1);
         assertTrue(result);
         assertTrue("event1: actionPerformed called for component", action1.event != null);
         assertFalse(event1.isConsumed());
-
         action1.event = null;
         result = SwingUtilities.processKeyBindings(event2);
         assertTrue(result);
         assertNull("event2: wrong actionPerformed called for parent", action1.event);
         assertTrue("event2: right actionPerformed called for parent", action2.event != null);
         assertFalse(event2.isConsumed());
-
         action2.event = null;
         result = SwingUtilities.processKeyBindings(event3);
         assertTrue(result);
@@ -1538,7 +1421,6 @@
         assertNull("event3: actionPerformed called for brother", action2.event);
         assertTrue("event3: actionPerformed called for component", action3.event != null);
         assertFalse(event3.isConsumed());
-
         action3.event = null;
         result = SwingUtilities.processKeyBindings(event4);
         assertTrue(result);
@@ -1548,19 +1430,20 @@
         assertTrue("event4: actionPerformed called for brother", action41.event != null);
         assertNull("event4: actionPerformed called for brother", action42.event);
         assertFalse(event4.isConsumed());
-
         result = SwingUtilities.processKeyBindings(event5);
         assertTrue(result);
         assertTrue("event5: actionPerformed called for parent", action51.event != null);
         assertNull("event5: actionPerformed called for parent", action53.event);
         assertFalse(event5.isConsumed());
-
         JComponent panel1 = new JPanel();
         JComponent panel2 = new JPanel();
         JTextField editor = new JTextField();
-        KeyEvent event6 = new KeyEvent(editor, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_ENTER, '\n');
-        panel1.registerKeyboardAction(action52, keyStroke5, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-        panel2.registerKeyboardAction(action54, keyStroke5, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        KeyEvent event6 = new KeyEvent(editor, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_ENTER,
+                '\n');
+        panel1.registerKeyboardAction(action52, keyStroke5,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        panel2.registerKeyboardAction(action54, keyStroke5,
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
         panel2.add(panel1);
         panel1.add(editor);
         result = SwingUtilities.processKeyBindings(event6);
@@ -1572,60 +1455,54 @@
 
     public void testUpdateComponentTreeUI() throws Exception {
         LookAndFeel laf = UIManager.getLookAndFeel();
-    try {
-        JPanel panel1 = new JPanel();
-        JPanel panel2 = new JPanel();
-        JButton button1 = new JButton("1");
-        JButton button2 = new JButton("2");
-        panel1.add(button1);
-        panel1.add(button2);
-        panel2.add(panel1);
-
-        String lookAndFeel1 = "org.apache.harmony.x.swing.plaf.metal.MetalLookAndFeel";
         try {
-            UIManager.setLookAndFeel(lookAndFeel1);
-        } catch (ClassNotFoundException e) {
-        } catch (UnsupportedLookAndFeelException e) {
-        } catch (Exception e) {
+            JPanel panel1 = new JPanel();
+            JPanel panel2 = new JPanel();
+            JButton button1 = new JButton("1");
+            JButton button2 = new JButton("2");
+            panel1.add(button1);
+            panel1.add(button2);
+            panel2.add(panel1);
+            String lookAndFeel1 = "org.apache.harmony.x.swing.plaf.metal.MetalLookAndFeel";
+            try {
+                UIManager.setLookAndFeel(lookAndFeel1);
+            } catch (ClassNotFoundException e) {
+            } catch (UnsupportedLookAndFeelException e) {
+            } catch (Exception e) {
+            }
+            ComponentUI ui1 = button1.getUI();
+            ComponentUI ui2 = button2.getUI();
+            ComponentUI ui3 = panel1.getUI();
+            ComponentUI ui4 = panel2.getUI();
+            assertTrue(ui1.getClass().getName().endsWith("MetalButtonUI"));
+            assertTrue(ui2.getClass().getName().endsWith("MetalButtonUI"));
+            assertTrue(ui3.getClass().getName().endsWith("BasicPanelUI"));
+            assertTrue(ui4.getClass().getName().endsWith("BasicPanelUI"));
+            button1.setUI(null);
+            button2.setUI(null);
+            panel1.setUI(null);
+            panel2.setUI(null);
+            SwingUtilities.updateComponentTreeUI(panel1);
+            ui1 = button1.getUI();
+            ui2 = button2.getUI();
+            ui3 = panel1.getUI();
+            ui4 = panel2.getUI();
+            assertTrue(ui1.getClass().getName().endsWith("MetalButtonUI"));
+            assertTrue(ui2.getClass().getName().endsWith("MetalButtonUI"));
+            assertTrue(ui3.getClass().getName().endsWith("BasicPanelUI"));
+            assertNull(ui4);
+        } finally {
+            UIManager.setLookAndFeel(laf);
         }
-
-        ComponentUI ui1 = button1.getUI();
-        ComponentUI ui2 = button2.getUI();
-        ComponentUI ui3 = panel1.getUI();
-        ComponentUI ui4 = panel2.getUI();
-        assertTrue(ui1.getClass().getName().endsWith("MetalButtonUI"));
-        assertTrue(ui2.getClass().getName().endsWith("MetalButtonUI"));
-        assertTrue(ui3.getClass().getName().endsWith("BasicPanelUI"));
-        assertTrue(ui4.getClass().getName().endsWith("BasicPanelUI"));
-
-        button1.setUI(null);
-        button2.setUI(null);
-        panel1.setUI(null);
-        panel2.setUI(null);
-        SwingUtilities.updateComponentTreeUI(panel1);
-
-        ui1 = button1.getUI();
-        ui2 = button2.getUI();
-        ui3 = panel1.getUI();
-        ui4 = panel2.getUI();
-        assertTrue(ui1.getClass().getName().endsWith("MetalButtonUI"));
-        assertTrue(ui2.getClass().getName().endsWith("MetalButtonUI"));
-        assertTrue(ui3.getClass().getName().endsWith("BasicPanelUI"));
-        assertNull(ui4);
-    } finally {
-        UIManager.setLookAndFeel(laf);
-    }
     }
 
     public void testGetAccessibleIndexInParent() {
         assertTrue(SwingUtilities.getAccessibleIndexInParent(new JButton()) == -1);
         JPanel panel = new JPanel();
         assertTrue(SwingUtilities.getAccessibleIndexInParent(panel) == -1);
-
         Component component = new JPanel();
         panel.add(component);
         assertTrue(SwingUtilities.getAccessibleIndexInParent(component) == 0);
-
         final Component container = new Container();
         panel.add(container);
         testExceptionalCase(new NullPointerCase() {
@@ -1633,7 +1510,6 @@
                 SwingUtilities.getAccessibleIndexInParent(container);
             }
         });
-
         component = new JPanel();
         panel.add(component);
         assertTrue(SwingUtilities.getAccessibleIndexInParent(component) == 1);
@@ -1645,20 +1521,15 @@
                 SwingUtilities.getAccessibleChildrenCount(null);
             }
         });
-
         assertTrue(SwingUtilities.getAccessibleChildrenCount(new JButton()) == 0);
         JPanel panel = new JPanel();
         assertTrue(SwingUtilities.getAccessibleChildrenCount(panel) == 0);
-
         panel.add(new JPanel());
         assertTrue(SwingUtilities.getAccessibleChildrenCount(panel) == 1);
-
         panel.add(new Container());
         assertTrue(SwingUtilities.getAccessibleChildrenCount(panel) == 1);
-
         panel.add(new JPanel());
         assertTrue(SwingUtilities.getAccessibleChildrenCount(panel) == 2);
-
         panel.add(new Container());
         assertTrue(SwingUtilities.getAccessibleChildrenCount(panel) == 2);
     }
@@ -1666,5 +1537,4 @@
     public void testIsEventDispatchThread() {
         assertTrue(SwingUtilities.isEventDispatchThread());
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/SwingWaitTestCase.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/SwingWaitTestCase.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/SwingWaitTestCase.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/SwingWaitTestCase.java Sat Nov 25 16:04:10 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -36,7 +35,6 @@
  *
  */
 public abstract class SwingWaitTestCase extends BasicSwingTestCase {
-
     private static final int MAX_WAIT_TIME = 5000;
 
     /**
@@ -60,12 +58,14 @@
      * the test to run correctly.
      */
     protected Component component;
+
     /**
      * Exception thrown during test execution if any.
      */
-    protected Throwable  exception;
+    protected Throwable exception;
 
     private static boolean bWasIllegalComponentStateException;
+
     private static Point next;
 
     /**
@@ -86,7 +86,6 @@
                 }
             }
         });
-
         // Wait for component to be realized (displayed) if any
         if (component != null) {
             isRealized(component);
@@ -105,7 +104,6 @@
                 }
             }
         });
-
         EventQueue.invokeAndWait(new Runnable() {
             public void run() {
                 try {
@@ -117,15 +115,16 @@
                 }
             }
         });
-
     }
 
+    @Override
     public void runBare() throws Throwable {
         internalRunBare();
         if (exception != null) {
             rethrow(exception);
         }
     }
+
     /**
      * Method delays current thread while Component isn't realized.
      *
@@ -140,7 +139,6 @@
             bWasIllegalComponentStateException = false;
             prev = next;
             next = null;
-
             try {
                 // Get state from the component
                 SwingUtilities.invokeAndWait(new Runnable() {
@@ -152,16 +150,13 @@
                         }
                     }
                 });
-
                 Thread.sleep(100);
             } catch (IllegalArgumentException e) {
             } catch (InterruptedException e) {
             } catch (InvocationTargetException e) {
             }
-
-        } while (!c.isDisplayable() || !c.isVisible()
-                || bWasIllegalComponentStateException || (next == null)
-                || !next.equals(prev) || (counter-- <= 0));
+        } while (!c.isDisplayable() || !c.isVisible() || bWasIllegalComponentStateException
+                || (next == null) || !next.equals(prev) || (counter-- <= 0));
         if (bWasIllegalComponentStateException) {
             System.err.println("bWasIllegalComponentStateException");
         }
@@ -172,37 +167,32 @@
      * Requests focus for the component and waits until it really
      * becomes focused.
      */
-    public static void requestFocusInWindowForComponent(final Component c) throws InterruptedException, InvocationTargetException {
+    public static void requestFocusInWindowForComponent(final Component c)
+            throws InterruptedException, InvocationTargetException {
         final Component comp = c;
-
         final Window w = SwingUtilities.getWindowAncestor(comp);
         if (w == null) {
             fail("no window is provided");
             return;
         }
-
         long startTime = System.currentTimeMillis();
         while (!comp.isShowing() && (System.currentTimeMillis() - startTime) < MAX_WAIT_TIME) {
             Thread.sleep(10);
         }
-
         if (!comp.isShowing()) {
             fail("component is not showing");
             return;
         }
-
         startTime = System.currentTimeMillis();
         while (!w.isFocused() && (System.currentTimeMillis() - startTime) < MAX_WAIT_TIME) {
             Thread.sleep(10);
         }
-
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 final boolean result = comp.requestFocusInWindow();
                 assertTrue("focus can be gained", result || comp.isFocusOwner());
             }
         });
-
         startTime = System.currentTimeMillis();
         while (!comp.isFocusOwner() && (System.currentTimeMillis() - startTime) < MAX_WAIT_TIME) {
             Thread.sleep(10);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/TestBundle.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/TestBundle.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/TestBundle.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/TestBundle.java Sat Nov 25 16:04:10 2006
@@ -15,17 +15,17 @@
  *  limitations under the License.
  */
 /**
-* @author Sergey Burlak
-* @version $Revision$
-*/
+ * @author Sergey Burlak
+ * @version $Revision$
+ */
 package javax.swing;
 
 import java.util.ListResourceBundle;
 
 public class TestBundle extends ListResourceBundle {
+    @Override
     protected Object[][] getContents() {
-        Object[][] objects = new Object[][] {
-                { "OptionPane.okButtonText", "OK" },
+        Object[][] objects = new Object[][] { { "OptionPane.okButtonText", "OK" },
                 { "OptionPane.titleText", "Select an Option" } };
         return objects;
     }