Here is the sample code :

What this code(function) does is everytime an user clicks new in the file
menu,
a new internal frame(a workspace) is added to the desktop pane.

The addition of the internal frame is no problem but i am only able to paint
only on the newly opened internal frame and not on any of the previously

opened ones.Why is this? I am not ablt to draw on the other frames except
on the new one.
Can anyone check the code and point out what is wrong with the code?
Thanks

{
this.setBusy(true, new Cursor(Cursor.WAIT_CURSOR));
boolean result = true;

workSpace = parent.getWorkSpace();
// there is already a workspace
if (workSpace != null)
{
//check if workspace has been modified
if (workSpace.isModified())
{
// ask if user wants to save the current workspace
int buttonClicked = JOptionPane.showConfirmDialog(-------something);

if (buttonClicked == JOptionPane.CANCEL_OPTION)
result = false; //return to current workspace
else if (buttonClicked == JOptionPane.YES_OPTION)
{
//save workspace then load new workspace
result = saveWorkSpace();//returns a boolean
}
}
}

if (result)
{
// create a new work space
workSpace = new WorkSpace(parent);//WorkSpace is a class
this.getInfoWnd().setSelectedObj(null);

// create the new view
internalFrame = new JInternalFrame("Frame #" + (++openFrameCount),
true, //resizable
true, //closable
true, //maximizable
true); //iconifiable
internalFrame.setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
internalFrame.setOpaque(true);
ClientView = new ClientView(this);
scrollClient = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollClient.setViewportView(ClientView);
internalFrame.setContentPane(scrollClient);
scrollClient.validate();
internalFrame.pack();
internalFrame.show();
desktopPane.add(internalFrame);

try
{
internalFrame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
internalFrame.moveToFront();


//internalFrame.addMouseListener(myMouseAdapter);

internalFrame.addInternalFrameListener(new InternalFrameAdapter()
{
public void internalFrameActivated(InternalFrameEvent ife)
{
JInternalFrame iFrame = desktopPane.getSelectedFrame();
iFrame.requestFocus();

}
});
workSpace.updateWorkspace();
this.updateClientViewProperties();
//when new workspace pressed, enable save, save as and print
}
//reset cursor
this.setBusy(false, new Cursor(Cursor.DEFAULT_CURSOR)); this.requestFocus();
return result;
}