다음 코드 삽과는 nullpointerexception을 발생시킵니다. findByName 메서드에 의해 throw됩니다. PlayerComponentGroupList를 찾을 수없는 것 같지만 그 이유는 모르겠습니다.findByName NullPointerException
어떻게 생성 된 componentgroup을 참조 할 수 있습니까?
protected void beforeMain(Form f) {
super.beforeMain(f);
try {
findPlayerComponentGroup(f).addComponent(getItems("Player"));
} catch (IOException ex) {
throw new RuntimeException(ex.getMessage());
}
}
private Container getItems(String order) throws IOException {
...
final Container rows = new ComponentGroup();
...
rows.setName("PlayerComponentGroupList");
return rows;
}
protected void onMain_PlayerContainerButtonSortNameAction(Component c, ActionEvent event) {
super.onMain_PlayerContainerButtonSortNameAction(c, event);
try {
findPlayerComponentGroup().removeComponent(findByName("PlayerComponentGroupList", Display.getInstance().getCurrent())));
...
}
예외를 throw하는 방법은 무엇입니까? 디버거에서 실행하고 null을 반환하는 이유는 무엇입니까? –
죄송합니다.이 포퍼를 공식적으로 작성하지 않았습니다 : findByName .... 질문 수정 – Megachip