Creating a jtable copy

Hi
I want to copy a only some rows ( say for e.g 1-5 and 10-15 rows ) of a JTable to another JTable
How to do this ?
Regards
kmm

Hi
Thanks for that
Following code i try to make a copy of the table which is passed into this method
But copyPrintingModel , is empty at the the end of the loop but the elementcount is same that in
the table. i.e. the data is added but the copyPrintingModel looses the data.
I suppose thats because of , copyPrintingModel.addRow -- perhaps stores only the reference and once that
goes out of scope , the data is lost
Please give me tips to avoid that i.e. i want the data to be persistant in copyPrintingModel
private JTable filterParams(JTable forParamFilter) {
DefaultTableModel forPrintingModel = (DefaultTableModel) forParamFilter.getModel();
int i = 0;     
JTable copyParamFilter = new JTable();
DefaultTableModel copyPrintingModel = new DefaultTableModel();
while(i < noOfRows){
         copyPrintingModel.addRow((Vector) forPrintingModel.getDataVector().elementAt(i));
         i++;
}

Similar Messages

  • How do I create a JTable with some empty cells in it?

    I have a three column JTable. The first column is a String showing description. The second column contains numbers (double) and the third column also contains numbers. In some cases not all cells in a row should contain data. So for instance, I could have row one showing only description (a String in the first column), and then row two showing description (a String in the first column) and a number (a double in the second column) in columns one and two respectively. My problem is that, the data gets copied from the cells with data to the cells which are supposed to be empty. So, how do I create a JTable with some empty cells in it.

    I have tried empty strings for those values, but it did not work. My table puts objects in an arraylist called reconciliation. The arraylist takes different objects with the same super class. The code below explains. Are you suggesting I pass null to my constructor?
    JTable table = new JTable(new ReconTableModel());The method below is from the table model
    protected  List<Reconciliation> reconciliation = new ArrayList<Reconciliation>();
    protected void fillModel(){
          reconciliation.add(new CashBook("Cash Book Report"," "," "));
          reconciliation.add(new CheckingBankAccount("Checking Bank Account"," "," "));
          reconciliation.add(new BankBalance("Bank Balance As Per Bank Statement",500," "));
          reconciliation.add(new PaymentVouchers("Payment Voucher Receipt",300," "));
          reconciliation.add(new DepositVoucher("Deposit Voucher Receipt",1000," "));
          reconciliation.add(new ReconciledBalance("Reconcilied Bank Balance",1200," "));
          reconciliation.add(new BalanceAt("Bank Balance At",800," "));
          reconciliation.add(new Difference("Difference",400," "));
          Collections.sort( reconciliation, new Comparator<Reconciliation>(){
          public int compare( Reconciliation a, Reconciliation b) {
            return a.getTransactionName().compareTo( b.getTransactionName());
      }

  • Create a JTable based on an ArrayList containing instances of a class.

    I have a class, IncomeBudgetItem, instances of which are contained in an ArrayList. I would like to create a JTable, based on this ArrayList. One variable is a string, while others are type double. Not all variables are to appear in the JTable.
    The internal logic of my program is already working. And my GUI is largely constructed. I'm just not sure how to make them talk to each other. The actually creation of the JTable is my biggest problem right now.

    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.util.ArrayList;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    public class TableDemo extends JPanel {
         private boolean DEBUG = false;
         public TableDemo() {
              super(new GridLayout(1, 0));
              ArrayList<MyObject> list = new ArrayList<MyObject>();
              list.add(new MyObject("Kathy", "Smith", "Snowboarding", new Integer(5),
                        new Boolean(false)));
              list.add(new MyObject("John", "Doe", "Rowing", new Integer(3),
                        new Boolean(true)));
              list.add(new MyObject("Sue", "Black", "Knitting", new Integer(2),
                        new Boolean(false)));
              list.add(new MyObject("Jane", "White", "Speed reading",
                        new Integer(20), new Boolean(true)));
              JTable table = new JTable(new MyTableModel(list));
              table.setPreferredScrollableViewportSize(new Dimension(500, 70));
              table.setFillsViewportHeight(true);
              // Create the scroll pane and add the table to it.
              JScrollPane scrollPane = new JScrollPane(table);
              // Add the scroll pane to this panel.
              add(scrollPane);
         class MyObject {
              String firstName;
              String lastName;
              String sport;
              int years;
              boolean isVeg;
              MyObject(String firstName, String lastName, String sport, int years,
                        boolean isVeg) {
                   this.firstName = firstName;
                   this.lastName = lastName;
                   this.sport = sport;
                   this.years = years;
                   this.isVeg = isVeg;
         class MyTableModel extends AbstractTableModel {
              private String[] columnNames = { "First Name", "Last Name", "Sport",
                        "# of Years", "Vegetarian" };
              ArrayList<MyObject> list = null;
              MyTableModel(ArrayList<MyObject> list) {
                   this.list = list;
              public int getColumnCount() {
                   return columnNames.length;
              public int getRowCount() {
                   return list.size();
              public String getColumnName(int col) {
                   return columnNames[col];
              public Object getValueAt(int row, int col) {
                   MyObject object = list.get(row);
                   switch (col) {
                   case 0:
                        return object.firstName;
                   case 1:
                        return object.lastName;
                   case 2:
                        return object.sport;
                   case 3:
                        return object.years;
                   case 4:
                        return object.isVeg;
                   default:
                        return "unknown";
              public Class getColumnClass(int c) {
                   return getValueAt(0, c).getClass();
          * Create the GUI and show it. For thread safety, this method should be
          * invoked from the event-dispatching thread.
         private static void createAndShowGUI() {
              // Create and set up the window.
              JFrame frame = new JFrame("TableDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // Create and set up the content pane.
              TableDemo newContentPane = new TableDemo();
              newContentPane.setOpaque(true); // content panes must be opaque
              frame.setContentPane(newContentPane);
              // Display the window.
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args) {
              // Schedule a job for the event-dispatching thread:
              // creating and showing this application's GUI.
              javax.swing.SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        createAndShowGUI();
    }

  • How can you create a virtual copy in a Lightroom plugin?

    I looked over the Lightroom SDK and did not see any documentation on creating a virtual copy. Is there an undocumented API for this?
    If not, is there a plan to add this into the SDK?

    Hi Matt,
    Yeah, I have some good news and some bad news:
    - Good news: Keyboard stuffing (as implemented in the elare framework) works equally well on both platforms, provided the appropriate keystroke exists on both platforms.
      (Mac version uses applescript, Windows uses autohotkey - both assure Lightroom is the target) - Note: @2011-07-30, I haven't actually tested this particular function on Mac - but I've tested other similar functions on both platforms.
    - Bad news: It doesn't always work on either platform, since keystrokes may be usurped by open dialog boxes and open text fields in Lightroom...
    - Good news: failure is 100% detectable.
    Bottom line:
    If the kludgy nature of this solution would be more bad than good for you and/or your users, then this is not a viable solution.
    If your users would prefer the caveats in order to be able to get the job, then this solution will work well enough for now.
    PS - I'm presently using it in ChangeManager and its a godsend for me. Since I understand the limitations, my failure rate is appx. 0%.
    ~R

  • In iTunes 11, what is the best way to delete the iTunes purchased song from my library after I create an aiff copy?

    I use my MacBook Pro as a music server. After downloading a song from the iTunes store I create an AIFF copy in my laptop's iTunes  Library. I then delete the original purchased song from the library to avoid duplicates. In iTunes prior to version 11 I had no difficulties doing this. The purchased copy just went back to the cloud and awaited future download onto other devices  leaving the new AIFF copy in my laptop's library. In iTunes 11 it is not as easy. The purchased version wants to stay in my library even after it is  deleted. What is the best (simplest) process to delete the compressed copy completely from my laptop's library while leaving the Aiff version. However, I want the original version to be available in the cloud for download on my other devices. Quite often my efforts have resulted in hiding the song frm the cloud! Any suggestion.....?

    Zice wrote:
    I want higher resolution then afforded in the original download.
    Then why are you converting iTunes purchases?
    You cannot get higher resolution by converting  the original. This goes for converting anything, not just iTunes purchases.
    Creating an AIFF will simply make the file 10 time as large with zero increase in quality.
    Don't really want to debate value of creating the new version.
    Agreed.
    You are simply wasting time and drive space converting iTunes purchases to AIFF.

  • Creating a bitmap copy of a TextFlow object without the caret [cursor]

    Hey all
    I'm currently working on creating a bitmap copy of a TextFlow object and I am looking at hiding the caret. What would be the best way forward, using the focusmanager to 'unfocus' the TextFlow object, or is there some more direct approach available? I know there is a cursormanager in Flex, but this is an AS3 only project.
    Cheers for your thoughts once again
    emd

    I think I've just done something similar to what you need (except I'm adjusting the width of the bitmap according to that of the text), and so far I have seen no cursor
    Here's the code. You'll need to adjust it depending on how many containers (Sprites) you are drawing the TextFlow to.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   applicationComplete="init()">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:Group id="groupText" width="560" />
        <fx:Script>
            <![CDATA[
                import flashx.textLayout.container.ContainerController;
                import flashx.textLayout.conversion.TextConverter;
                import flashx.textLayout.elements.TextFlow;
                import mx.core.UIComponent;
                private function init() : void
                    var text : String = "Greek god gives mints.";
                    var fontSize : int = 24;
                    //We create a textflow with some text and set it's font size, just as an example.
                    var flow : TextFlow = TextConverter.importToFlow(text, TextConverter.PLAIN_TEXT_FORMAT);
                    flow.fontSize = 24;
                    //We'll use a single container (and consecuently a single controller)
                    var container : Sprite = new Sprite()
                    var controller : ContainerController = new ContainerController(container);
                    flow.flowComposer.addController(controller);
                    //This is kind of weird, but I saw it in a TLF example, and it works.
                    //It seems you have to "stretch" the container.
                    controller.setCompositionSize(this.stage.stageWidth, this.stage.stageHeight);
                    flow.flowComposer.compose();
                    //Set the text's actual width and height as the composition size.
                    controller.setCompositionSize(controller.getContentBounds().width,
                        controller.getContentBounds().height);
                    //Redraw.
                    flow.flowComposer.updateAllControllers();
                    //As BitmapData's draw method takes an IBitmapDrawable,
                    //we'll need to wrap the Sprite instance in an UIComponent.
                    var tf : UIComponent = new UIComponent();
                    tf.addChild(container);
                    //Create an instance of BitmapData and "draw the container" into it.
                    var bd : BitmapData = new BitmapData(controller.getContentBounds().width,
                        controller.getContentBounds().height + 2, true, 0x000000);
                    bd.draw(tf);
                    //Create a Bitmap with the text's data and add it to the application.
                    var bmp : Bitmap = new Bitmap(bd);
                    var ui : UIComponent = new UIComponent();
                    ui.addChild(bmp);
                    this.groupText.addElement(ui);           
            ]]>
        </fx:Script>
    </s:Application>
    Hope it helps,
    Sebastián.

  • How do I create a jtable with horizontalScroll bar,plz help me!

    I created a jtable component,Because my table's columns has 50 items,I must need a horizontalScroll Bar.
    but I find the horizontalScroll don't display,when I add record to the jtable,the verticalScroll Bar is showed.How do I create a jtable with horizontalScroll bar,can u help me!
    thank you in advance!

    Hi,
    This piece of code will help :
         //Get the Component Adapter for taking action against resizing of
    //of Panel
    ComponentListenerAdapter componentAdapter =
    new ComponentListenerAdapter()
    //Get the scrollbar or remove the scrollbar upon resizing
    protected void resizingAction()
    Container tableParent = table.getParent();
    if (tableParent instanceof JViewport)
    //Check if the width of the Table Parent Container
    //is less than the Preferred Size of the Table
    if (tableParent.getSize().getWidth() <
    table.getPreferredSize().getWidth())
    //Yes it is
    //Remove the Auton Resize Function and get the
    //Scrollbar
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF );
    else
    //No it is not
    //Get the Auto Resize functionality back in place
    table.setAutoResizeMode(
    JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
    //Add the component Adapter to the Table Header
    table.getTableHeader().addComponentListener(componentAdapter);
    private abstract class ComponentListenerAdapter
    implements ComponentListener
              * The <code>componentHidden<code> method has no implementation
              * @param event The Event occured whenever the Component is Hidden
              public void componentHidden(ComponentEvent event)
                   //No Implementaion - Intentially Left Blank
              * The <code>componentShown</code> method has no implementation
              * @param event The Event occured whenever the Component is Shown
              public void componentShown(ComponentEvent event)
                   //No Implementaion - Intentially Left Blank
              * The <code>componentMoved</code> method has no implementation
              * @param event The Event occured whenever the Component is Moved
              public void componentMoved(ComponentEvent event)
                   //No Implementaion - Intentially Left Blank
              * The <code>componentResized</code> method is invoked whenever the
              * component is resized. The resizing action will set the columns and
              * scrollbar to act properly
              * @param event The Event occured whenever the Component is Resized
              public void componentResized(ComponentEvent event)
                   resizingAction();
    * Subclasses of this override this method to determine what is to be
    * done once the Component has been Resized
    protected abstract void resizingAction();
    Hope this will solve all your JTable horizontal resizing problems
    --j                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Creating a deep copy

    I wrote a stack implementation using a LinkedList, I have null constructor to create the first stack and it works fine but now i have to create a copy for a second stack using the element of the first constructor
    this my code
    import java.util.LinkedList;
    public class Stack<T>{
      private LinkedList<T> stack;
      public Stack(){
        stack =  new LinkedList<T>();
      public Stack(Stack<T> s) {// the problem is here it compile but when i run
                                                     // the program the second stack raised an exception because is empty
                                                     // i want to create a deep copy with the elements of the first stack
         stack = new LinkedList<T>();
      public boolean isEmpty(){
      return stack.isEmpty();
      public void push(T item){
       /*method to add object information
        *pre the object is not full
        * pos: the object is inserted
          stack.addFirst(item);
      public T top() throws EmptyStackException{
        if (!stack.isEmpty()){ 
          return stack.getFirst();
        else{
          throw new EmptyStackException("StackException on top " + " Stack empty");
      public T pop() throws EmptyStackException{
        /*method to remove an element of the stack
        *pre the object is not empty
        * pos: the object is remove
        * response throws an exception
        if (!stack.isEmpty()){ 
          return stack.removeFirst();
        else{
          throw new EmptyStackException("StackException on top" + "stack empty");
    public int numElements(){
        return stack.size();
    public void clear(){
      stack.clear();
    public class EmptyStackException extends Exception{
            public EmptyStackException( String message){
              super(message);
    }

    wel well... are you doing this on a mobile phone???
    neways to get to ur question u can use the clone() method to generate a clone of your object which is the same as a deep copy for eg:
    public class CloneTest{
        CloneTest test1 = new CloneTest();
        CloneTest test2;
        CloneTest(){
          //Some initialization code;
        CloneTest(CloneTest temp){
             test2 = test1.clone();
    }clone is a method of the object class.

  • How to Create a database copy and specify the source database.

    Hello,
    In my dag environment I would like to create a new database copy and specify the source. My company has database copies in 2 locations. Instead of transferring the data from one location to the other, I would like to specify the source be the copy that is
    in the same location.
    Thank you,
    ~Mark

    Hi,
    We can create a mailbox database, then run EMC and EMS to create a database copy.
    More details about Add a Mailbox Database Copy, for your reference:
    https://technet.microsoft.com/en-us/library/dd298080(v=exchg.141).aspx
    Note: please pay attention to Prerequisites section, for example: 
    1. The specified Mailbox server must not already host a copy of the specified mailbox database.
    2. The server hosting the specified database and the server that will host the database copy must both be in the same database availability group (DAG). The DAG must also have quorum and be healthy.
    Thanks
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Allen Wang
    TechNet Community Support

  • Can anyone teach me how to create a JTable

    In my project, i would like to make a class extends JTable for which it can function like the excel one.
    This means that the table can split into two parts.
    Each of them have a standalone view and can let user to update the table.

    Had some time to spare so a quick rough example.
    Note this makes use of the TableModel created by JTable when passed an Object[][].
    I'd recommend instead that you create your own TableModel and pass that to both JTables yourself.
    import javax.swing.*;
    import javax.swing.table.*;
    public class SplitTableDemo extends JFrame
       public SplitTableDemo(String title) {
            super(title);
            // prepare data
            int cols = 26;
            int rows = 200;
            Object[][] data = new Object[rows][cols];
            for (int j=0; j<rows; j++) {
                for (int k=0; k<cols; k++) {
                    data[j][k] = new String("");
            // prepare column names
            Object[] columnNames = new Object[cols];
            for (int m=0; m<cols; m++) {
                char c = (char) (65+m);   
                columnNames[m] = String.valueOf(c);
            // create first table view
            JTable upperTable = new JTable(data, columnNames);
            // create second table view with same model (obtained from first)
            TableModel tm = upperTable.getModel();
            JTable lowerTable = new JTable(tm);
            // put tables in ScrollPanes
            JScrollPane upperScroller = new JScrollPane(upperTable);
            JScrollPane lowerScroller = new JScrollPane(lowerTable);
            // display in split pane
            JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upperScroller, lowerScroller);
            this.getContentPane().add(sp);
       public static void main (String[] args)
          SplitTableDemo splitTableDemo = new SplitTableDemo("Split Table Demo");
          splitTableDemo.pack();
          splitTableDemo.show();
    }

  • How to create block by copying parent value to all of its children

    Hi All,
    I need to create blocks by copying the parent value into it's children, however, the following does not work:
    DATACOPY "Profit"->"Actuals"->"2012"->"Period Total"->@PARENT(@CURRMBR("Business")) TO "Profit_2"->"Budget"->"2013"->"Input Mth"->@CURRMBR("Business")
    Does anyone know how to go about achieving this?
    Cheers,

    from source to target
    copy data
    FIX ( "Profit","2012","Period Total",@Idescendants("Business",-1))
    "Actuals"(
    Account_NA=0;
    ENDFIX
    FIX ( "Profit","2012","Period Total",@RELATIVE("Business",0))
    "Actuals"(
    IF(Account_NA->@PARENT(@CURRMBR("Business")+0 == 0)
    "Profit_2"->"Budget"->"2013"->"Input Mth"->@CURRMBR("Business"))= "Profit"->"Actuals"->"2012"->"Period Total"->@PARENT(@CURRMBR("Business"));
    Account_NA->@PARENT(@CURRMBR("Business"))=1;
    ENDIF;
    ENDFIX
    copy block
    FIX ( "Profit","2012","Period Total",@RELATIVE("Business",0))
    "Actuals"(
    "Profit_2"->"Budget"->"2013"->"Input Mth" = "Profit"->"Actuals"->"2012"->"Period Total"->@PARENT(@CURRMBR("Business"));
    ENDFIX

  • Create a Hard Copy

    Hello,
    I have successfully downloaded Lion from the App Store, is it possible to create a hard copy to put on disk so I know I have it?
    Thanks

    Try to think beyond iWeb :
    https://discussions.apple.com/message/13285302#13285302
    http://blog.wyodor.net/2011/08/page-setup-in-pages-for-use-in-iweb.html
    iWork Pages or similar are usually more suited to create books or publications.

  • Creating An Automation - Copy, Archive

    Hi,
    I'm new to Final Cut Server (FC Server) and learning it now.
    Have a few questions, searched the internet for answers but still hope for assistance here.
    - Within "Search Expired" response, what is the purpose of "Event Type"?
    - Within "Subscription" trigger, what is the purpose of "Event Type Filter"?
    I'm trying to achieve these workflows,
    1. Create a backup copy of the FC Server "Asset Library" onto another "device"
    2. Create a archive, when the asset is last accessed or modified for certain days
    For the above, I create 2 "Subscriptions".
    Subscription 1 has 2 responses, Event Type Filter = Custom 1
    1st response is "Search Expired",
    - Event Type = Custom 1
    - File Creation Date = Last 24 Hours
    2nd response is "Copy",
    - Destination = Xsan Device (SNFS/Storage Manager Volume)
    Subscription 2 has 2 responses, Event Type Filter = Custom 2
    1st response is "Search Expired",
    - Event Type = Custom 2
    - Last Modified = 2 Day
    2nd response is "Move to Archive",
    - Destination = Archive Device (SNFS/Storage Manager Volume)
    I tried creating Schedulers using the same responses above, but no success as well.
    Hope someone can advice me.
    Hope you can share if there is a website which has instructions on creating automations.
    Cheers,
    Ben

    Here is the link for the release notes that explain about Event type filter in subscriptions. Basically it tell the subscription the event (on the asset) that will trigger the response (when you "create" an asset, when an asset is "modified", etc)
    http://www.apple.com/support/releasenotes/en/FinalCut_Server_1.0rn/
    I think you are doing it backwards with the search expired. The first mistake you are making is that you can only trigger search expired responses with Schedules (you can check this in the setup guide page 199)
    This is how I'll do it.
    First make a schedule (that runs whenever you need it to run) that trigger the 1st search expired response (Event type custom1) Here you can add some filters so you'll only affect some assets if you want to
    Second create a Subscription with event type filter = custom 1 that will trigger the Copy response
    For the Archive response is all the same but remember to use custom2 event
    I haven't test this myself but it should work.
    Let me know if it does.
    Best regards

  • Creating a JTable as a leaf for JTree

    Is it possible to create a JTable as leaf node of a JTree..?
    I used treecellrenderer which returns JTable as component.. but i'm getting a single row of table in my tree..? How can i solve this..?

    bbritta,
    Thanks a lot.. for u'r support. But actually i don't want to have some kind of explorer type interface with a tree on the left side of a panel & a TABLE . I want to have a JTable as a leaf node in JTree. I mean i need JTable as node for Jtree.. But still teh code u suggested make some sense.. i will give a try.. Thanks..
    gussev,
    U got my problem..!
    "that is possible, at the beginning of the next month, even at the end of this I'm going to release several JavaBeans and "JTable as a node for a JTree" bean would be available. I'll send a message to forum. "
    I'm eagerly waiting for u'r message..
    Thanks
    Saran

  • Lightroom 4 - creates a new copy of the catalog

    I use to have all my pictures in a single catalog - "MyPics". It contains around 50.000 photos.
    Last week, LR4 has silently created a new copy of my catalog: "MyPics-2". No warning, no message. I did not notice immediately.
    The 2 catalog files have roughly the same size, but the preview folders are very different:
    old: 350MB, 100 files, 115 folders
    new: 280GB, 47000 files, 34000 folders
    I assume it moved the preview files from old to new.
    I am wondering what happened. Has anybody seen something similar?
    Is my assumption of moved preview files correct?
    Is this related to the upgrade from LR3.6 to LR4?
    Thanks for any hint!
    Jean-Paul
    LR4, Win7x64, 8GB Ram

    [email protected] wrote:
    Last week, LR4 has silently created a new copy of my catalog: "MyPics-2". No warning, no message. I did not notice immediately.
    Is this related to the upgrade from LR3.6 to LR4?
    When you upgraded to LR4, Lightroom would have asked you if you want your existing LR3 catalog upgraded to LR4. Part of that dialog would have been telling you what the new catalog would be called (giving you the chance to choose a different name and location)....I guess you missed that part, amd you clicked through and thus accepted LR's default.
    So during the catalog upgrade the existing LR3 catalog (MyPics.lrcat) would have been left in place, and the new LR4 version (called MyPics-2.lrcat) would have been created. Also during that process the existing LR3 Preview cache (MyPics Previews.lrdata) would have been 'confiscated' by LR4 to become the preview cache for the upgraded catalog (and so would have been renamed MyPics-2 Previews.lrdata).
    I guess you have subsequently started up LR3 again, which would immediately have created a new previews cache (MyPics Previews.lrdata) which will slowly get bigger if you carry on using LR3....but initially it would be very small as you have discovered.
    So just to be clear:
    MyPics.lrcat is your LR3 catalog
    MyPics-2.lrcat is your LR4 catalog. I personally rename upgraded catalogs to include the LR version number in order to avoid confusion.

Maybe you are looking for