if(getJListEvents().getModel().getSize()>0){
getJListEvents().setSelectedIndex(0);
}
}
public void eventShow(){
Event event=null;
// Retrieve selected event
if (jListEvents.getSelectedIndex() >= 0
&& jListEvents.getSelectedIndex() < jListEvents
.getModel().getSize()) {
EventsListModel listModel=(EventsListModel)jListEvents.getModel();
event=listModel.getDataAt(jListEvents.getSelectedIndex());
}
if (jPanelEventsDetailsViewer != null) {
// Checking if selected event is already active
if(event!=null && jPanelEventsDetailsViewer.getEvent() != null){
if(event==jPanelEventsDetailsViewer.getEvent()){return;}
}
// Cleaning active event
jPanelEventsDetailsViewer.setVisible(false);
jPanelEventsDetails.remove(jPanelEventsDetailsViewer);
jPanelEventsDetailsViewer = null;
}
// Loading selected event
if (event!=null){
jPanelEventsDetailsViewer = event.getViewer();
jPanelEventsDetailsViewer.setEvent(event);
jPanelEventsDetails.add(jPanelEventsDetailsViewer, BorderLayout.CENTER);
jPanelEventsDetails.updateUI();
}
}