[jaxx] branch develop updated (b35193f -> 283943d)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git from b35193f refs #3501: Introduce a new jaxx-widgets-datetime module (can show hide time editor slider) new 283943d fixes #3524 Add a progressbar and a title to the splashscreen The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 283943d111f6c23761e259ea498843f975deb639 Author: Kevin Morin <morin@codelutin.com> Date: Wed Oct 1 15:28:40 2014 +0200 fixes #3524 Add a progressbar and a title to the splashscreen Summary of changes: .../nuiton/jaxx/widgets/extra/SplashScreen.java | 205 +++++++++++---------- 1 file changed, 111 insertions(+), 94 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 283943d111f6c23761e259ea498843f975deb639 Author: Kevin Morin <morin@codelutin.com> Date: Wed Oct 1 15:28:40 2014 +0200 fixes #3524 Add a progressbar and a title to the splashscreen --- .../nuiton/jaxx/widgets/extra/SplashScreen.java | 205 +++++++++++---------- 1 file changed, 111 insertions(+), 94 deletions(-) diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java index d41cf72..6adb627 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java @@ -34,28 +34,22 @@ package org.nuiton.jaxx.widgets.extra; -import java.awt.AlphaComposite; -import java.awt.Composite; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.GridBagConstraints; -import java.awt.Image; -import java.awt.Toolkit; +import java.awt.*; +import java.net.URL; import java.util.Timer; import java.util.TimerTask; -import javax.swing.ImageIcon; -import javax.swing.JFrame; +import javax.swing.*; +import javax.swing.border.EtchedBorder; /** - * + * @author kmorin - morin@codelutin.com */ public class SplashScreen extends JFrame { - private static final long serialVersionUID=1L; + private static final long serialVersionUID = 1L; - public final static long DEFAULT_DURATION = 3000; +// public final static long DEFAULT_DURATION = 3000; public final static long DEFAULT_REMANENCE = 5000; @@ -65,18 +59,15 @@ public class SplashScreen extends JFrame { public final static int DEFAULT_STEPPING_BOTTOM_INSET = 100; - public final static Composite defaultComposite = AlphaComposite - .getInstance(AlphaComposite.SRC_OVER, 0.7f); + public final static Composite defaultComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f); protected long remanence = DEFAULT_REMANENCE; protected Image splashImage; - protected String applicationTitle; + protected Title applicationTitle; - protected long estimatedDuration; - - protected String[] stepDescriptions; +// protected String[] stepDescriptions; protected Image[] stepImages; @@ -94,56 +85,34 @@ public class SplashScreen extends JFrame { protected ImageAnimator imageAnimator; - public SplashScreen(String applicationTitle, String splashImagePath) { - this(applicationTitle, splashImagePath, DEFAULT_DURATION); - } - - public SplashScreen(String applicationTitle, String splashImagePath, - long estimatedDuration) { - this(applicationTitle, splashImagePath, estimatedDuration, null); - } - - public SplashScreen(String applicationTitle, String splashImagePath, - long estimatedDuration, String[] stepDescriptions) { - this(applicationTitle, splashImagePath, estimatedDuration, - stepDescriptions, null); - } - - public SplashScreen(String applicationTitle, String splashImagePath, - String[] stepDescriptions) { - this(applicationTitle, splashImagePath, DEFAULT_DURATION, - stepDescriptions, null); + public SplashScreen(String splashImagePath) { + this(splashImagePath, null); } - public SplashScreen(String applicationTitle, String splashImagePath, - String[] stepDescriptions, String[] stepImagesPaths) { - this(applicationTitle, splashImagePath, DEFAULT_DURATION, - stepDescriptions, stepImagesPaths); + public SplashScreen(String splashImagePath, Title applicationTitle) { + this(splashImagePath, applicationTitle, null); } - public SplashScreen(String applicationTitle, String splashImagePath, - long estimatedDuration, String[] stepDescriptions, - String[] stepIconsPaths) { + public SplashScreen(String splashImagePath, Title applicationTitle, String[] stepImagesPaths) { super(); this.applicationTitle = applicationTitle; - this.estimatedDuration = estimatedDuration; - this.stepDescriptions = stepDescriptions; - initialize(splashImagePath, stepIconsPaths); +// this.stepDescriptions = stepDescriptions; + initialize(splashImagePath, stepImagesPaths); } /** * @return Returns the stepDescriptions. */ - public String[] getstepDescriptions() { - return stepDescriptions; - } +// public String[] getStepDescriptions() { +// return stepDescriptions; +// } /** * @param stepDescriptions The stepDescriptions to set. */ - public void setstepDescriptions(String[] stepDescriptions) { - this.stepDescriptions = stepDescriptions; - } +// public void setStepDescriptions(String[] stepDescriptions) { +// this.stepDescriptions = stepDescriptions; +// } /** * @return Returns the steppingInset. @@ -176,7 +145,7 @@ public class SplashScreen extends JFrame { /** * @return Returns the applicationTitle. */ - public String getApplicationTitle() { + public Title getApplicationTitle() { return applicationTitle; } @@ -197,9 +166,9 @@ public class SplashScreen extends JFrame { /** * @return Returns the estimatedDuration. */ - public long getEstimatedDuration() { - return estimatedDuration; - } +// public long getEstimatedDuration() { +// return estimatedDuration; +// } /** * @return Returns the splashImage. @@ -243,6 +212,14 @@ public class SplashScreen extends JFrame { this.currentComposite = currentComposite; } + public long getRemanence() { + return remanence; + } + + public void setRemanence(long remanence) { + this.remanence = remanence; + } + public void nextStep() { if (imageAnimator != null) { imageAnimator.cancel(); @@ -306,13 +283,15 @@ public class SplashScreen extends JFrame { protected void paintSplash(Graphics g) { g.drawImage(splashImage, 0, 0, null); - // TODO draw application Title - // TODO - if (stepImages == null) { - // TODO DRAW PROGRESS BAR - // g.fillRect(50,50,100,3); - } else { + if (applicationTitle != null) { + g.setColor(applicationTitle.getColor()); + g.setFont(applicationTitle.getFont()); + Point position = applicationTitle.getPosition(); + g.drawString(applicationTitle.getLabel(), position.x, position.y); + } + + if (stepImages != null) { // draw step images int steppingInset = (getSplashImage().getWidth(null) - getSteppingLeftInset() - getSteppingRightInset()) @@ -333,26 +312,25 @@ public class SplashScreen extends JFrame { } protected void initialize(String splashImagePath, String[] stepIconsPaths) { - initializeUI(); - - splashImage = getImage(splashImagePath); - this.setUndecorated(true); - this.positionAtCenter(splashImage.getWidth(null), splashImage - .getHeight(null)); - // this.setAlwaysOnTop(true); // TODO JDK5.0 specific - this.setVisible(true); - if (stepIconsPaths != null) { stepImages = new Image[stepIconsPaths.length]; for (int i = 0; i < stepIconsPaths.length; i++) { stepImages[i] = getImage(stepIconsPaths[i]); } } + + splashImage = getImage(splashImagePath); + + initializeUI(); + + this.setUndecorated(true); + this.positionAtCenter(splashImage.getWidth(null), splashImage.getHeight(null)); + this.setVisible(true); } protected Image getImage(String imagePath) { Image result = null; - java.net.URL imageURL = getClass().getResource(imagePath); + URL imageURL = getClass().getResource(imagePath); if (imageURL != null) { result = new ImageIcon(imageURL).getImage(); } @@ -365,26 +343,23 @@ public class SplashScreen extends JFrame { */ protected void positionAtCenter(int width, int height) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - setBounds((screenSize.width - width) / 2, - (screenSize.height - height) / 2, width, height); + setBounds((screenSize.width - width) / 2, (screenSize.height - height) / 2, width, height); } protected void initializeUI() { this.setContentPane(getJContentPane()); } - protected javax.swing.JPanel jContentPane = null; + protected JPanel jContentPane = null; - protected javax.swing.JPanel getJContentPane() { + protected JPanel getJContentPane() { if (jContentPane == null) { - jContentPane = new javax.swing.JPanel(); - jContentPane - .setBorder(javax.swing.BorderFactory - .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); + jContentPane = new JPanel(); + jContentPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); jContentPane.setLayout(new java.awt.GridBagLayout()); - java.awt.GridBagConstraints gridBagConstraints = new GridBagConstraints(); + GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0D; gridBagConstraints.weighty = 1.0D; jContentPane.add(getSplashPane(), gridBagConstraints); @@ -392,12 +367,13 @@ public class SplashScreen extends JFrame { return jContentPane; } - protected javax.swing.JPanel splashPane = null; + protected JPanel splashPane = null; - protected javax.swing.JPanel getSplashPane() { + protected JPanel getSplashPane() { if (splashPane == null) { - splashPane = new javax.swing.JPanel() { - private static final long serialVersionUID=1L; + + splashPane = new JPanel() { + private static final long serialVersionUID = 1L; @Override public void paint(Graphics g) { @@ -405,6 +381,12 @@ public class SplashScreen extends JFrame { } }; splashPane.setLayout(new java.awt.BorderLayout()); + + if (stepImages == null) { + JProgressBar progressBar = new JProgressBar(); + progressBar.setIndeterminate(true); + splashPane.add(progressBar, BorderLayout.SOUTH); + } } return splashPane; } @@ -422,6 +404,7 @@ public class SplashScreen extends JFrame { @Override public void run() { + dispose(); setVisible(false); } @@ -430,13 +413,16 @@ public class SplashScreen extends JFrame { // public static void main(String[] args) { - SplashScreen f = new SplashScreen( - "SplashScreen v0.1\n Released under GNU General Public License v2.0", - "/redGecko.jpg", new String[] {}, new String[] { - "/64x64/camera.png", "/64x64/joystick.png", - "/64x64/modem.png", "/64x64/mouse.png", + Title title = new Title("SplashScreen v0.1\n Released under GNU General Public License v2.0", + new Font(Font.SERIF, Font.PLAIN, 20), + new Point(20, 20), + Color.WHITE); + SplashScreen f = new SplashScreen("/redGecko.jpg", title, new String[] { + "/64x64/camera.png", "/64x64/joystick.png", + "/64x64/modem.png", "/64x64/mouse.png", "/64x64/pda.png", "/64x64/printer.png", - "/64x64/scanner.png", "/64x64/tablet.png" }); + "/64x64/scanner.png", "/64x64/tablet.png" + }); try { Thread.sleep(500); } catch (InterruptedException e) { @@ -464,4 +450,35 @@ public class SplashScreen extends JFrame { System.exit(0); } + public static class Title { + + protected String label; + protected Font font; + protected Point position; + protected Color color; + + public Title(String label, Font font, Point position, Color color) { + this.label = label; + this.font = font; + this.position = position; + this.color = color; + } + + public String getLabel() { + return label; + } + + public Font getFont() { + return font; + } + + public Point getPosition() { + return position; + } + + public Color getColor() { + return color; + } + } + } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm