Results 1 to 2 of 2
  1. #1
    Jerba is offline Member
    Join Date
    Feb 2013
    Rep Power

    Question [JPanel] In window splash screen.

    Hello, I've been playing around with what i like to call an in window slash screen.

    I've been using the paintComponent method and using a swing timer, however, i don't believe this is the most efficient way to do it, if anyone knows a simpler way of doing it, or a better more efficient way of doing, please leave a comment.


    Current Code: Doesn't actually work... and i can't figure out why.
    package org.main;

    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;

    import javax.swing.ImageIcon;
    import javax.swing.JPanel;
    import javax.swing.Timer;

    public class Splash extends JPanel {

    private static final long serialVersionUID = 1L;

    Image image;
    Timer timer;

    ImageIcon splash = new ImageIcon("res/splash.png");

    public Splash() {
    image = splash.getImage();
    timer = new Timer(3000, new LoadAction());

    public void paintComponent(Graphics g) {
    g.drawImage(image, 0, 0, null);

    class LoadAction implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    if(image != null && timer != null) {
    image = null;
    System.out.println("Removed Drawing");

    public Image getImage() {
    return image;
    Last edited by Jerba; 02-21-2013 at 08:35 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

Similar Threads

  1. Problem with splash screen
    By frintocf in forum AWT / Swing
    Replies: 1
    Last Post: 09-07-2011, 12:42 AM
  2. Splash Screen How?
    By bircastri in forum AWT / Swing
    Replies: 1
    Last Post: 11-16-2010, 05:51 PM
  3. Splash Screen
    By madcommu in forum SWT / JFace
    Replies: 4
    Last Post: 09-18-2010, 02:14 PM
  4. splash screen
    By joypik in forum AWT / Swing
    Replies: 1
    Last Post: 07-13-2010, 08:48 PM
  5. Splash Screen
    By Doctor Cactus in forum New To Java
    Replies: 1
    Last Post: 10-29-2008, 07:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts