Originally posted by Nathan Pruett:
OK, after hearing what you really wanted to do, I think the best plan would be to use the exact same Swing GUI for both modes. Don't bother drawing widgets to prevent people from editing data. Just make a method on your panel that calls setEnabled() and setEditable() on all the components. Just pass true or false in based on the mode.
Thanks Nathan,
I can't follow that plan because of some other requrements. In viewer mode we are having a concept called fields which are actually bound to the external XML data OR External Database (Something similar to Access reports connected to databse tables) So the fields can have formatting like it can be bold or it can have color, and a custome background(Which has been created by end user.) etc. Also there can be other Java2d components like rectangles, ellipses etc which needs to be very accutately rendererd for the printing purpose, the data might be displayed vertically etc. So We dont want to change the existing code much.
Anyway We had made some changes in the existing code so that I can get the instance of the JPanel so this problem has been alleviated.
Thanks for your timely help.
Sachin