Changeset 14578 in josm


Ignore:
Timestamp:
2018-12-21T00:22:27+01:00 (5 weeks ago)
Author:
Don-vip
Message:

It's Christmas time! Animate our "Getting Started" page with shining stars.

Adapted from Icedtea-Web, original code by Jiri Vanek (Red Hat).
See http://icedtea.classpath.org/hg/icedtea-web/rev/87d3081ab573

Location:
trunk
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CONTRIBUTION

    r13834 r14578  
    8080- https://github.com/codebling/WindowsShortcuts
    8181
     82The gui/animation Christmas GPL code is from Jiri Vanek (Red Hat):
     83- http://icedtea.classpath.org/hg/icedtea-web/rev/87d3081ab573
     84
    8285------------------------------- PROJECTION DATA -------------------------------
    8386
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r14480 r14578  
    66import java.awt.BorderLayout;
    77import java.awt.EventQueue;
     8import java.awt.Graphics;
    89import java.io.IOException;
    910import java.net.URL;
     
    1516import javax.swing.JPanel;
    1617import javax.swing.JScrollPane;
     18import javax.swing.Timer;
    1719import javax.swing.border.EmptyBorder;
    1820import javax.swing.event.HyperlinkEvent;
     
    2123import org.openstreetmap.josm.actions.DownloadPrimitiveAction;
    2224import org.openstreetmap.josm.data.Version;
     25import org.openstreetmap.josm.gui.animation.AnimationExtensionManager;
    2326import org.openstreetmap.josm.gui.datatransfer.OpenTransferHandler;
    2427import org.openstreetmap.josm.gui.dialogs.MenuItemSearchDialog;
     
    4649    private String content = "";
    4750    private boolean contentInitialized;
     51    private final Timer timer = new Timer(50, e -> repaint());
    4852
    4953    private static final String STYLE = "<style type=\"text/css\">\n"
     
    142146
    143147        setTransferHandler(new OpenTransferHandler());
     148    }
     149
     150    @Override
     151    public void addNotify() {
     152        timer.start();
     153        super.addNotify();
     154    }
     155
     156    @Override
     157    public void removeNotify() {
     158        timer.stop();
     159        super.removeNotify();
     160    }
     161
     162    @Override
     163    public void paint(Graphics g) {
     164        super.paint(g);
     165        if (isShowing()) {
     166            AnimationExtensionManager.getExtension().adjustForSize(getWidth(), getHeight());
     167            AnimationExtensionManager.getExtension().animate();
     168            AnimationExtensionManager.getExtension().paint(g);
     169        }
    144170    }
    145171
Note: See TracChangeset for help on using the changeset viewer.