void (@NotNull Object o, boolean show) { for (Class<?> clazz = o.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) { for (Field field : clazz.getDeclaredFields()) { field.setAccessible(true); try { Object v = field.get(o); if (v instanceof JComponent) { ((JComponent)v).setVisible(show); } } catch (IllegalAccessException e) { // Ignore } } } }