Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2006

Tip: Looking for answers? Try searching our database.

Help Cloning Objects

Thread view: 
Bill - 26 Aug 2006 14:12 GMT
Hi All,
   I currently have a database 'explorer' application - show lists of
tables; ddl etc etc

   I'd now like to be able to 'clone' a snapshot view into another
frame....

frame 1
   has a jpanel_X  + scroll pane + jtable with data etc

new frame 2

   has a jpanel_Y - which I'd like to reflect the exact same contents as
frame 1

I've tried

     panel_Y = panel_X.clone();

   but get
               Error(35,26): method clone() has protected access in class
java.lang.Object

   I've added the Cloneable interface to jpanel_X - but I still get the
error message....

TIA

Bill

---------------------------------------------------------------------------------------------------
public class V_Db2Explorer_ListView extends JPanel
       implements ActionListener, Cloneable {

......

   public interface Cloneable {

   }
---------------------------------------------------------------------------------------------------
Dieter Lamberty - 27 Aug 2006 09:56 GMT
Bill schrieb:
> Hi All,
>     I currently have a database 'explorer' application - show lists of
[quoted text clipped - 22 lines]
>
> Bill

Hi Bill

What you would like to have is a clone of the data, not a clone of the
panel.
So you should clone the data in the table by either cloning the (your)
TableModels or the data contained in it.

First you have to make your class implement the Cloneable Interface and
implement the clone method as public. This is what the error message says...

Hope that helps
Dieter


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.