I tryed to add all components which are marked with the Component Annotation, but the components not getting added
// Adds all components to the JPanel
private void addComponents() throws InvocationTargetException, IllegalAccessException {
for(Method method : getClass().getDeclaredMethods()){
if(method.isAnnotationPresent(Component.class))
add(method.invoke(this));
}
for (int x = 0; x < getComponents().length; x++)
getComponents()[x].setFocusable(false);
}
// Single Player button
@Component
private JButton singlePlayer() {
return singlePlayer;
}
// Multi Player button
@Component
private JButton multiPlayer() {
return multiPlayer;
}