SwingXUtilities { static RepaintManager getTranslucentRepaintManager(RepaintManager delegate) { RepaintManager manager = delegate; while (manager != null && !manager.getClass().isAnnotationPresent(TranslucentRepaintManager.class)) { if (manager instanceof ForwardingRepaintManager) { manager = ((ForwardingRepaintManager) manager).getDelegateManager(); } else { manager = null; } } return manager == null ? new RepaintManagerX(delegate) : delegate; } private  SwingXUtilities(); static void updateMnemonicBinding(JComponent c, String pressed); static void updateMnemonicBinding(JComponent c, String pressed, String released); static void setComponentTreeEnabled(Component c, boolean enabled); static void setComponentTreeLocale(Component c, Locale locale); static void setComponentTreeBackground(Component c, Color color); static void setComponentTreeForeground(Component c, Color color); static void setComponentTreeFont(Component c, Font font); static void setHtmlFont(HTMLDocument doc, Font font); static void updateAllComponentTreeUIs(); static void updateAllComponentTreeUIs(Window window); static FutureTask<T> invokeLater(Callable<T> callable); static T invokeAndWait(Callable<T> callable); @SuppressWarnings("unchecked") static T getAncestor(Class<T> clazz, Component c); static boolean isDescendingFrom(Component focusOwner, Component parent); static boolean isUIInstallable(Object property); static void setLeadAnchorWithoutSelection(
            ListSelectionModel selectionModel, int lead, int anchor); static boolean shouldIgnore(MouseEvent mouseEvent,
            JComponent component); static int loc2IndexFileList(JList list, Point point); static void adjustFocus(JComponent component); static int convertModifiersToDropAction(int modifiers,
            int sourcActions);  }
@Test(expected = NullPointerException.class) public void testGetTranslucentRepaintManagerWithNull() { SwingXUtilities.getTranslucentRepaintManager(null); }
@Test public void testGetTranslucentRepaintManagerWithTranslucent() { RepaintManagerX rmx = new RepaintManagerX(new RepaintManager()); RepaintManager rm = SwingXUtilities.getTranslucentRepaintManager(rmx); assertSame(rmx, rm); }
@Test public void testGetTranslucentRepaintManagerWithNonTranslucent() { RepaintManager rm = new RepaintManager(); RepaintManager rmx = SwingXUtilities.getTranslucentRepaintManager(rm); assertNotSame(rm, rmx); assertTrue(rmx.getClass().isAnnotationPresent(TranslucentRepaintManager.class)); }
@Test public void testGetTranslucentRepaintManagerWithForwardingAndTranslucent() { RepaintManagerX rmx = new RepaintManagerX(new RepaintManager()); ForwardingRepaintManager frm = new ForwardingRepaintManager(rmx); RepaintManager rm = SwingXUtilities.getTranslucentRepaintManager(frm); assertSame(frm, rm); }
@Test public void testGetTranslucentRepaintManagerWithForwardingAndNonTranslucent() { ForwardingRepaintManager frm = new ForwardingRepaintManager(new RepaintManager()); RepaintManager rm = SwingXUtilities.getTranslucentRepaintManager(frm); assertNotSame(frm, rm); assertTrue(rm.getClass().isAnnotationPresent(TranslucentRepaintManager.class)); }