progressBar.setValue(page); revalidate(); repaint();
progressModel.setValue(page);
	public void update(Observable o, Object arg) {		if (o == searchModel && !busy1) {			busy1 = true;			resultsPanel.removeAll();			progressBar.setValue(0);			progressBar.setMinimum(0);			progressBar.setMaximum(searchModel.getPageCount());			progressBar.setVisible(true);			revalidate();			repaint();			new Thread(new Runnable() {				public void run() {					try {						for (int i = 1; i <= searchModel.getPageCount(); i++) {							final ImageData[] thumbs = searchModel.getPage(i);							final int page = i;							EventQueue.invokeLater(new Runnable() {								public void run() {									ResultsPanel.this.addImages(thumbs);									progressBar.setValue(page);									revalidate();									repaint();								}							});						}					} catch (final IOException e) {						EventQueue.invokeLater(new Runnable() {							public void run() {								JOptionPane.showMessageDialog(ResultsPanel.this,										e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);							}						});					} finally  {						ResultsPanel.this.busy1 = false;						EventQueue.invokeLater(new Runnable() {							public void run() {								progressBar.setVisible(false);									revalidate();								repaint();							}						});					}				}			}).start();		}		else if (o == fullSizeImgModel && ! busy2) {			busy2 = true;			fullSizePanel.setImage(null);			fsProgressBar.setVisible(true);			cardLayout.show(centerPanel, "fullSize");			new Thread(new Runnable() {				public void run() {					try {						URL url = fullSizeImgModel.getImageData().getUrl();						final ImageData id = ImageData.loadUrl(url);						EventQueue.invokeLater(new Runnable() {							public void run() {								fullSizePanel.setImage(id);							}						});					} catch (IOException e) {						// TODO: dialog						System.err.println("ERROR: Cannot load requested image!");						EventQueue.invokeLater(new Runnable() {							public void run() {								cardLayout.show(centerPanel, "results");							}						});					} finally {						ResultsPanel.this.busy2 = false;						EventQueue.invokeLater(new Runnable() {							public void run() {								fsProgressBar.setVisible(false);							}						});					}				}			}).start();		}	}