You need to request repaint .
JButton b = new JButton("Change Image"); b.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ bi = bi2;
You might also need to call invalidate first so that the container is marked for repainting by the repaint manager
If you know the area you want to paint (i.e. the old area and the new area), you can call paintImmediately instead
So something like this might work too ...
int w = ((int) dim.getWidth() / 2) - (bi.getWidth() / 2); int h = ((int) dim.getHeight() / 2) - (bi.getHeight() / 2); Rectangle oldArea = new Rectangle(w, h, bi.getWidth(), bi.getHeight()); bi = bi2; w = ((int) dim.getWidth() / 2) - (bi.getWidth() / 2); h = ((int) dim.getHeight() / 2) - (bi.getHeight() / 2); Rectangle newArea = new Rectangle(w, h, bi.getWidth(), bi.getHeight()); Area area = new Area(); area.add(oldArea); area.add(newArea); Rectangle updateArea = area.getBounds(); paintImmediately(updateArea);
Madprogrammer
source share