import java.awt.BorderLayout;
import java.awt.Component;
+import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
*/
public JProgressBar getProgressBar(long id)
{
- for (Component component : progressBars.get(id).getComponents())
- {
+ Container progBar = progressBars.get(id);
+ if (progBar==null || progBar.getComponentCount()==0)
+ {
+ return null;
+ }
+ for (Component component : progBar.getComponents())
+ {
if (component.getClass().equals(JProgressBar.class))
- return (JProgressBar) component;
+ {
+ return (JProgressBar) component;
+ }
}
return null;
}