Friday, 3 September 2010

How to merge PDF files for free?

(For the latest PDF files Merger Software please have a look at the top of the left margine, inside the red box.) Google has advised me to write a blog with this title to help search engine crawlers find this place for relevant software. Since if I do not put that question directly on the title then search engines are not able to recognize that. I wrote this software as a demo and for my personal usage many years ago, perhaps 2003 or 2004. I had not any idea that it could be of some assistance to public. Recently, my daughter, mentioned me that it could be useful making it available for public. When I put it here, swiftly few hundred downloads reported to my blog stat in Google Analytic. Having noticed the interest, I started to test the software with the stress tests of a user not the way that I could use it personally and I noticed many bugs in it. Immediately I removed the bugs and deprecated the alpha version. Then I received few further issues and on a nightly basis newer versions uploaded to Messiah's Site. A help and issue page also was established. I noticed that for a full utilization of the software I needed to have a PDF file splitter and a software to inject a PDF file into a certain page of another PDF file. Some of the users kindly have advised me for creating some other PDF software. I am a retired teacher and a retired System Analyst. But to fulfil that demand I am busy to do that task. I have two gadgets at hand right now that prevents my full-time endeavour on the PDF software. One is related to control systems theory which I have written in java language at the moment but I like to rewrite it in assembly code to be readily usable for embedded systems and the other is an educational gadget. All will come free on public domain. So obeying the advice to help the crawlers to come here I have a humble answer for "How to combine PDF files, how to join PDF files, how to split PDF files and how to insert one PDF file inside another PDF file."
Update, May 2016 : Dysprosium (Dolce edition) has been released (please click) based on iText from mid of April 2014 and smoothly on a nightly basis added more features and now I have deprecated many scattered pieces of PDF utilities I already released. There are so many features that I cannot write complete instructions for all of them. From other previous pieces only Signature manager has been remained to be integrated. I sorted out PDF viewer problem somehow satisfactorily.)
(updated : 26/May/2016) I have had over 60,000 downloads from 187 countries. All around the world, only 1 country in South America (French Guiana) and 1 countries in Asia (Democratic North Korea ) have not used Dysprosium Software, yet. The remaing countries not downloaded to this date (less than 10) are from the central Africa and perhaps some very small Island countries.
 
 

Thursday, 5 August 2010

I Needed more Software for Working with PDF Files

Perhaps you are here for PDF software:

  • Clicking here or here (This version is slower but smaller download, 1.9MB. Latest stable beta_5_4_5; with features for "page numbering" and "re-size" and "zoom", and "rotate" based on iText : rev.24/March/11. Fully deprecated, now, 04/11/2014).
  • For a more advanced "in-progress" stable version click here or here (This version is faster but larger download, 4.5MB; Latest stable beta_6_7_2; includes all features of Beta_5 versions with additional features for "Signature Manager," and "Bookmark Manager" based on iText : rev.25/March/11. No more will be revised and replaced, now, 04/11/2014)
  • Stable PDF file Splitter free software now available from Messiah's download page at, here. Stable beta_6, 1.9 MB; new build, based on iText (21/March/11).

  • Please click on the "Question Mark" at the bottom right of the software to learn how to use it.
    I was scanning my old writings to pdf files. They are my handwritten diaries, or lecture notes and some of them are typed with old type-writers. When I was arranging them, consolidating files on some supposed order, I noticed that I had forgotten to scan some pages. I could scan those individual pages to pdf and then I could split the previously scanned files put the new scanned pages between them at the right places and merge them. Instead of that I created a software to inject or rather insert the skipped pages into their places in my volumes of scanned material. You can download that software free if you, too, have that requirement. All software have a visual help here.
    (Update, November 2014 : Dysprosium (Dolce edition) has been released (please click) based on iText from mid of April 2014 and smoothly on a nightly basis added more features and now I have deprecated many scattered pieces of PDF utilities I already released. There are so many features that I cannot write complete instructions for all of them. From other previous pieces only Signature manager has been remained to be integrated. I sorted out PDF viewer problem somehow satisfactorily.)

    Sunday, 13 June 2010

    A Free Software to Merge (Attaching) PDF Files Together

    (For the latest PDF files Merger Software please have a look at the top of the left margine, inside the red box.) Frequently in academic places you might need to consolidate or technically speaking you have to concatenate two or more pdf files together. It is due to the fact that you are creating or downloading a work, such as a series of lectures during a period of time then you would like to make them in one big volume. I have created a software to do that job for me. I used iText software. I put it here for your usage. It is in RC1 phase so far. It has no risk using it. No other software is bundled with this. It does not install anything on your computer. It does not do anything with your pdf files. In the worst case scenario that never happens (since that iText is very noble a software) the concatenation might not happen. I have tested it and am using it for a long time with different files I have downloaded or scanned from the books with no problem. It has no limitation on the size and number of files or usages of software on different platforms-Windows, Unix, or Mac. It is a pity not to make it available for others. I have used iText 2.7 for implementation. I am planning to use iText 5 now with all details of open source and other fusses to become available later. Meanwhile, please enjoy these humble versions, by
    click  here   or  here (Series 5 versions are slower but smaller download, 1.9MB. Latest stable Series 5 version 5.4.5; with features for "page numbering"  and  "re-size" and "zoom", and "rotate" based on iText : rev.24/March/11; finalised and no newer version will be released. Fully deprecated, now, 04/11/2014).
    For a more advanced  stable version click  here  or   here  (Series 6 versions are faster but larger download, 4.5MB. Latest stable Series 6 version 6.7.2;  includes all features of Series 5 versions with additional features for "Signature Manager," and "Bookmark Manager" based on iText :   rev.25/March/11; actively being tested and debugged - still becomes more improved).
    For simpler  versions please go here (Latest stable Release R2 safe to use and stable, works similar to Adobe combine feature, finalised based on iText : 22/March/11; finalised and no newer version will be released. Fully deprecated, now, 04/11/2014).
    This place includes a help and Visual Help, and encountered issues page, as well.
    The first free software for Insertion pdf file 23/March/11 here.

    Stable pdf Splitter free software now available from Messiah's download page at, here. (Stable beta_6, 3.85 MB; new build, improved bookmark split based on iText, 21/March/11).
    Please click on the "Question Mark" at the bottom right of the software to learn how to use it.
    New 07/07/2014 : Modern version of Dysprosium D6.xx includes more features for Merge, Split and Inject.  
    All older versions removed.
    For Merge software:
    You should have all the pieces of pdf files in one place, perhaps in a folder of their own, somewhere next to each other. (Still, do not worry; software won't include any non PDF files around there.) When application opens, click for "brows" and take the "file-chooser" to where you have your pdf files and then select one of them and click "OK" on the "file-chooser." It pops up for a name to choose for your consolidated file. The default consolidated pdf file name I have chosen starts with "ZZ" such that later you can recognize it easily among other pdf files. Still, you can write your own choice of name in the red highlighted text field but do not add pdf extension. Software adds it automatically. After clicking "OK" on the "name-chooser" pop up, all the pdf files in the directory comes in the "List Area" of the application. You can remove those you do not need from the list and arrange files in the order that you prefer to consolidate. Then click on the "Merge" button. It brings progress GUI for you and after few seconds or few minutes, depending on the size and number of files, you have your consolidated pdf file in the same directory as the others. Next "dialogue" box offers you more concatenation or exit, whatever you choose to do.
    Please check for improvements. You might like to use "subscribe feeds."
    Please note, Pdf calculations and regenerations take resources from your computer, sometimes for more than a minute, in particular, if the size of files are greater than 50 MB. Allow enough time to the software to crank and to crunch the job. All the default created files begins with "ZZ" to make it easier to find them.
    Please check this place for newer versions and newer software for PDF.
    Update, May 2016 : Dysprosium (Dolce edition) has been released (please click) based on iText from mid of April 2014 and smoothly on a nightly basis added more features and now I have deprecated many scattered pieces of PDF utilities I already released. There are so many features that I cannot write complete instructions for all of them. From other previous pieces only Signature manager has been remained to be integrated. I sorted out PDF viewer problem somehow satisfactorily.)
    (updated : 26/May/2016) I have had over 60,000 downloads from 187 countries. All around the world, only 1 country in South America (French Guiana) and 1 country in Asia (Democratic North Korea ) have not used Dysprosium Software, yet. The remaining countries not downloaded to this date (less than 10) are from the central Africa and perhaps some very small Island countries.
    ==================
    If you are merging large files, receiving "Map Failed" exception, then please increase your java heap as explained (please click) here.

    Friday, 30 April 2010

    Using Thread in Java to Create Animation, Example 5

    I said we use the paint() method to have a corner to creat my objects. Further I can have a class for my objects and create images there and bring them on my frame. I need only to pass the graphic of canvas to that class. Then I can even create more than one similar objects on the canvas and put them next together. I can have them resized and rotated and deformed. Now, I use some simple drawings and my aircraft bomber looks more real. I create it in a small sub-class to my canvas. Then I can call it from my paint() method. From this point you can use formalities of object-oriented languages for data encapsulations. But I prefer to experience with animations and put details of software engineering aside until I become fully fluent and in command of more basic details.


      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    package animation;
    
    /**
     *
     * author Peter Jones
     */
    public class Ex5Thread extends javax.swing.JFrame implements java.lang.Runnable {
    
        /**
         * Creates new form Ex5Thread
         */
        public Ex5Thread() {
            super("Example 5!"); // A title for the frame
            x = X0;
            y = Y0;
            aPanel = new javax.swing.JPanel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setPreferredSize(new java.awt.Dimension(840, 400));
            add(aPanel);
            pack();
            start();
        }
    
        /**
         * Start when browser is loaded or button pushed. *
         */
        public void start() {
            if (fThread == null) {
                fThread = new java.lang.Thread(this);
                fThread.start();
            }
        } // start
    
        /**
         * The thread loops to draw each frame.*
         */
        public void run() {
            //j=0;
            // Loop through animation frames
            while (fThread != null) {
                // Sleep between frames
                try {
                    Thread.sleep(10);
                    //build the first image
                    java.awt.Graphics gr = getGraphics();
                    paint(gr);
                    //next, move coordinates
                    //such that incoming image won't overlap
                    t += 1;
                    x = +(int) (V0 * t);
                    y = Y0 + (int) (G * t * t / 2);//y-coordinate of bomb
                } catch (InterruptedException e) {
                    break;
                } //break stops the loop
                // Now go to other frame
                other();
            }
        }// run ends
    
        // Your other frame comes here.
        public void other() {
            // check for the end of panel
            isDone();
            // Sleep between frames
            try {
                Thread.sleep(490);
                aPanel.repaint(); // meanwhile repaint the panel.
            } catch (InterruptedException e) {
            }
        }
    
        /* Boolean allows you to terminate this thread, if you like, and go to other tasks.
         * I used it to provide a flag for counting.
         */
        public boolean isDone() {
            boolean temp = false;
            if (x > 840) {//if reaches end of panel
                temp = true;
                t = 0; //initial t
                x = X0; //initial x
                y = Y0; //initial y
                aPanel.repaint(); //reset the panel
            }
            return temp;
        }
    
        //Create some graphic
        public void paint(java.awt.Graphics gr) {
            //Next, create object from sub-class!
            new airCraft().paint(gr, x, y, Y0);
            /* gr.setColor(java.awt.Color.green);
             gr.fillOval(x, Y0+10, 100, 20);//fuselage
    
             gr.setColor(java.awt.Color.red);
             gr.fillArc(x-20, Y0+5, 40, 20, 0, 100);//tail
             gr.fillArc(x+10, Y0+3, 60, 15, 0, 135);//far wing
             gr.fillArc(x+35, Y0+10, 35, 20, 0, -135);//front wing
    
             gr.setColor(java.awt.Color.gray);
             gr.fillArc(x+55, Y0+10, 40, 10, 0, 100);//cockpit
    
             gr.setColor(java.awt.Color.red);        
             gr.fillOval(x+30, Y0+y, 10, 5);//bomb*/
        }
    
        public static void main(String args[]) {
            new Ex5Thread().setVisible(true);
        }
    
        /* Variables declaration - do not modify
         * For simple GUI
         * For thread animation
         */
        private javax.swing.JPanel aPanel;
        private Thread fThread;
    
        /* Variables declaration - do not modify
         *
         */
        long t = 0; //seconds
    
        int x = 20; // X-coordinate of a point
        final int X0 = 20; // pixels
    
        int y = 50; // Y-coordinate of a point
        final int Y0 = 50; // pixels
    
        final int V0 = 60; // pixels/second
        final double G = 2.45; //pixels/second/second
        // End of variables declaration
    
    //sub-class creates some graphical object
        class airCraft {
    
            airCraft() {//Constructor
    
            }
    
            protected void paint(java.awt.Graphics gr, int x, int y, int Y) {
    
                gr.setColor(java.awt.Color.green);
                gr.fillOval(x, Y + 10, 100, 20);//fuselage
    
                gr.setColor(java.awt.Color.red);
                gr.fillArc(x - 20, Y + 5, 40, 20, 0, 100);//tail
                gr.fillArc(x + 10, Y + 3, 60, 15, 0, 135);//far wing
                gr.fillArc(x + 35, Y + 10, 35, 20, 0, -135);//front wing
    
                gr.setColor(java.awt.Color.gray);
                gr.fillArc(x + 55, Y + 10, 40, 10, 0, 100);//cockpit
    
                gr.setColor(java.awt.Color.red);
                gr.fillOval(x + 30, Y + y, 10, 5);//bomb
    
            }
        }
    
    }
    

    Click here to see the application. If you save the "jar" file in your computer you can use "7z" decompression utility to extract source file and image files.

    As you see this is not a smooth animation. To make it smooth, you need to calculate different timings such as effect of a frame on human eyes, rendering a nice artistic image with software, or use pictures instead, using Java Beans to dispatch property changes, using JavaFX and create scenes. When you become familiar with basics that I put here, you can discover further.

    Friday, 16 April 2010

    Using Thread in Java to Create Animation, Example 4

    In the previous example we introduced a simple graphic work. We introduced a paint() method in a cosy corner to create the image we need without interfering with other parts of application. Then we call it back and forth in our thread tick-tacks. To render that graphic to realize the graphical object on our canvas1 we need an instance of java.awt.Graphics which is always present there from deep down the system and easily we catch it from the things that native methods create for us. It is like palette of painters with color pastes on it and different brushes. Once you catch an instance of that you can use it everywhere. The best is to take it from the container that you are working on it. Here I took it from the javax swing panel that I had on my Frame. Once you put the paint() on your canvas to remove it you have to repaint() your canvas; other wise its effect remains there and in the next tick-tack you have still there. In this way you have a moving brush that creates some other type of animation if you are interested. It is like a trajectory you are watching. In this example I have created that effect. Nevertheless, I have to repaint() my panel at each renewal of the thread when the trajectory reaches to the end of canvas, somewhere in isDone() method. You can de-comment and re-comment related instructions to watch its effect. This Blog is the simplest explanation you ever could find anywhere for java threading and painting and animation. Please, have a look at Example 4.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    package Forward;
    
    /**
     *
     * author Peter Jones
     */
    public class Ex4Thread extends javax.swing.JFrame implements java.lang.Runnable{
    
        /** Creates new form Ex4Thread */
        public Ex4Thread() {
            super("Example 4!"); // A title for the frame
            T0=System.currentTimeMillis();
            x=X0;
            y=Y0;
            aPanel = new javax.swing.JPanel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setPreferredSize(new java.awt.Dimension(350, 120));
            add(aPanel);
            pack();
            start();
        }
    
        /** Start when browser is loaded or button pushed. **/
        public void start() {
            if (fThread == null){
                fThread = new java.lang.Thread (this);
                fThread.start();
            }
        } // start
    
        /** The thread loops to draw each frame.**/
        public void run() {
            j=0;
            // Loop through animation frames
            while ( fThread != null){
                // Sleep between frames
                try{
                    Thread.sleep (1);
                    t=System.currentTimeMillis()-T0;
                    t=t/1000; //convert to seconds
                    x=(int)(V0*t);
                    y=Y0+(int)(G*t*t/2);
                    paint();
                }
                catch (InterruptedException e) {break; } //break stops the loop
                // Now go to other frame
                other();
                isDone();
            //if (this.isDone()) fThread = null;
            }
        }// run ends
    
        // Your other frame comes here.
        public void other(){
            //
            ++j;
            // Sleep between frames
            try{
                Thread.sleep (1);
                //aPanel.repaint(); // meanwhile repaint the panel.
            }
            catch (InterruptedException e) { }
        }
    
        /* Boolean allows you to terminate this thread, if you like, and go to other tasks.
         * I used it to provide a flag for counting.
         */
        public boolean isDone() {
            boolean temp=false;
            if(j==COUNTS) {
                temp=true;
                j=0;
                T0=System.currentTimeMillis();
                x=X0;
                y=Y0;
                aPanel.repaint();
            }
        return temp;
        }
    
        //Create some graphic
        public void paint() {
    
            java.awt.Graphics g=aPanel.getGraphics();
            g.setColor(java.awt.Color.red);
            g.fillOval(x, Y0, 2, 2); //Object one (aircraft)
            g.fillOval(x, y, 2, 2); //Object two (released bomb)
           // g.setColor(java.awt.Color.gray);
            //g.fill3DRect(300, 80, 15, 30, true);
    
        }
    
        public static void main(String args[]) {
            new Ex4Thread().setVisible(true);
        }
    
        /* Variables declaration - do not modify
         * For simple GUI
         * For thread animation
         */
        private javax.swing.JPanel aPanel;
        private Thread fThread;
    
        /* Variables declaration - do not modify
         *
         */
        int j=0; //counter
        final int COUNTS=3500;
    
        double t=0; //seconds
        double T0=0; //seconds
    
        int x=0; // X-coordinate of a point
        final int X0=10; // pixels
    
        int y=0; // Y-coordinate of a point
        final int Y0=10; // pixels
    
        final int V0=25; // pixels/second
        final double G=0.98; //pixels/second/second
        // End of variables declaration
    }// End of class
    
    Click here to see the application. If you save the "jar" file in your computer you can use "7z" decompression utility to extract source file and image files.
    The first trajectory is simple and similar to previous one. It hs a constnt speed of V0=25. Second trajectory follows some rule of mathematics as y=(1/2)g.t2 It is an aircraft bomber with speed of 25 pixels per second and releases a bomb. I assumed the gravity should be one tenth of the earth gravity. It is 0.98 pixels per second per second. x-ccordinate of the bomb remains the same as x-coordiate of the bomber aircraft, that is x=V0*t,  but its y-coordinate changes according to law of gravity.
    It is important that you make a formula such that it could be cosistent with the dimensions of canvas. You also should consider for how long your frame remains in the sight. For that it is necessary, too, to know how long the effect of an exposure remains in the eye. It is 20 milli second.

    ==================================
    1. I mean canvas of painting. I do not mean Java AWT Canvas.

    Monday, 12 April 2010

    Using Thread in Java to Create Animation, Example 3

    Now, we are at a point to create animation on our canvas without using an image; doing it just by painting. Still we use the tick-tack technique between run() method and the other() method. Here we have to add a paint() method to create the desired object for us, we put a small red blob, an oval shape on the canvas, moving from left to right. The canvas is a java swing panel.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    package Forward;
     
    /**
     *
     * author Peter Jones
     */
    public class Ex3Thread extends javax.swing.JFrame implements java.lang.Runnable{
     
        /** Creates new form Ex3Thread */
        public Ex3Thread() {
            super("Example 3!"); // A title for the frame
            aPanel = new javax.swing.JPanel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setPreferredSize(new java.awt.Dimension(200, 100));
            add(aPanel);
            pack();
            start();
        }
     
        /** Start when browser is loaded or button pushed. **/
        public void start() {
            if (fThread == null){
                fThread = new java.lang.Thread (this);
                fThread.start();
            }
        } // start
     
        /** The thread loops to draw each frame.**/
        public void run() {
            j=0;
            // Loop through animation frames
            while ( fThread != null){
                // Sleep between frames
                try{
                    Thread.sleep (100);
                    x+=3;
                    paint();
                }
                catch (InterruptedException e) { }
                // Now go to other frame
                other();
                isDone();
            //if (this.isDone()) fThread = null;
            }
        }// run ends
     
        // Your other frame comes here.
        public void other(){
            //
            ++j;
            // Sleep between frames
            try{
                Thread.sleep (200);
                aPanel.repaint(); // meanwhile repaint the panel.
            }
            catch (InterruptedException e) { }
        }
     
        /* Boolean allows you to terminate this thread, if you like, and go to other tasks.
         * I used it to provide a flag for counting.
         */
        public boolean isDone() {
            boolean temp=false;
            if(j==COUNTS) {
                temp=true;
                j=0;
                x=10;
            }
        return temp;
        }
         
        //Create some graphic
        public void paint() {
             
            java.awt.Graphics g=aPanel.getGraphics();
            g.setColor(java.awt.Color.red);
            g.fillOval(x, 25, 5, 5);
        }
     
        public static void main(String args[]) {
            new Ex3Thread().setVisible(true);
        }
     
    /* Variables declaration - do not modify
    * For simple GUI
    */
    private javax.swing.JPanel aPanel;
     
    /* Variables declaration - do not modify
    * For thread animation
    */
    int j=0; //counter
    int x=10; // X-coordinate of a point
    Thread fThread;
    final int COUNTS=50;
    // End of variables declaration
    }
    
    
    Click here to see the application. If you save the "jar" file in your computer you can use "7z" decompression utility to extract source file and image files.

    Wednesday, 7 April 2010

    Using Thread in Java to Create Animation, Example 2

    We could run the thread by tick-tacking between the run() method and an auxiliary other() method, each take the thread to a certain sleep duration. You can test if you can remove the sleep from the other() method. Still you have tick tack but not smooth to create animation. The high of the clock pulse is equal to run() duration say 100 ms but the low (I measured using system time) is 3 to 4 milliseconds. you can add yet another anOther() method and a third image in your resources and get a better effect. you also can play with sleep duration to reach more smoothness in terms of visual subjective effects. you can consider the duration of effect when human eyes switches between two scenes. Now I make a more complex animation. I make these like the old neon lamps rather than using maths calculation and rendering graphics. If I use painting then my attention would be diverted to force correctness of java codes when running in hand in hand with the native operating system. That frequently needs adjustments which is not related to the job of animation. I should be confident that my animations work and encourage me to step forward rather than becoming disappointed. Then I can add other elements to them. This example put pieces of a whole picture consecutively and creates animation similar to the book-flicking through animation that children make using corner of pages of a book.

    package Forward;
    
    /**
    *
    * author Peter Jones
    */
    public class Ex2Thread extends javax.swing.JFrame implements java.lang.Runnable {
        /** Creates new form Ex2Thread */
        public Ex2Thread() {
            aPanel = new javax.swing.JPanel();
            aLabel = new javax.swing.JLabel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setPreferredSize(new java.awt.Dimension(50, 110));
            add(aPanel);
            aPanel.add(aLabel);
            pack();
            start();
        }
        /** Start when browser is loaded or button pushed. **/
        private void start() {
            if (fThread == null){
                fThread = new java.lang.Thread (this);
                fThread.start();
            }
        } // start
        /** The thread loops to draw each frame.**/
        public void run() {
            j=0;
            // Loop through animation frames
            while ( fThread != null){
                s = mString(j);
                // Sleep 100msecs between frames
                try{
                    Thread.sleep (100);
                    aLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource(s)));
                }
                catch (InterruptedException e) { }
                // Now go to other frame
                //++j;//
                other();
                isDone();
                //if (this.isDone()) fThread = null;
            }
        }// run ends
        // Your other frame comes here.
        public void other(){
            //
            ++j;
            // Sleep 100msecs between frames
            try{
                Thread.sleep (100);
            }
            catch (InterruptedException e) { }
        }
        // Boolean allows you to terminate this thread, if you like, and go to other tasks.
         // I used it to provide a flag for counting.
         //
        public boolean isDone() {
            boolean temp = false;
            if(j == COUNTS) {
                temp = true;
                j = 0;
            }
        return temp;
        }
    
        // This method creates strings "Sun0.gif", "Sun1.gif", ..., to "Sun7.gif"
        public String mString(int n){
            String aSt = "";
            aSt = "Sun".concat(java.lang.String.valueOf(n)).concat(".gif");
        return aSt;
        }
    
        /**
         * Next main
         */
        public static void main(String args[]) {
            new Ex2Thread().setVisible(true);
        }
        // Variables declaration - do not modify
        // For simple GUI
        //
        private javax.swing.JLabel aLabel;
        private javax.swing.JPanel aPanel;
        // Variables declaration - do not modify
        // For thread animation
        int j = 0;
        String s = "";
        Thread fThread;
        final int COUNTS = 8;
        // End of variables declaration
    }
    Click here to see the application. If you save the "jar" file in your computer you can use "7z" decompression utility to extract source file and image files.
    I took small image of "Helios" (Sun personified) in form of an icon. I used the Windows(R) Paint utility and sliced the icon in desired forms. In this way I got eight icons; from "Sun0.gif" to "Sun7.gif". I could make an array of images but I preferred to create a method mString(int n) to fetch the icons one after the other. Then I adjusted my counter from zero to seven to bring images one after another andput them on the java swing label. I could terminate the animation here and go to other jobs by calling isDone() method within the "if" statement and killing the thread; instead of that, I reset my counter back to zero to start it again. I used the isDone() method in a void type fashion. You know in java many boolens can work as void as well without their return value becomes utilized. Hence, I commented the "if" to prevent killing the thread and keep the tick-tack going on and on. If you un-comment this line and comment "j=0; statement" in the isDone() method, then the animation runs only once.
    You can also put the "++j" before call to the other() method inside the run() method and then make the call to other() method commented and see the effect. It works but not as smooth as before. Best is to give your clock one tick and one tack; one run() and one other(). Then go and adjust the desired timings inside each state of the run() and the other().