KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My main class loads configuration from a file then shows a frame. I want to make a splash screen with a progress bar like Eclipse so that the progress will increase while the file is being loaded and the splash disappears after the file is loaded. Then my main frame gets loaded. MainClass code: public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext( "classpath:/META-INF/spring/applicationContext.xml"); // splash with progress load till this file is loaded UserDao userDao = context.getBean(UserDao.class); isRegistered = userDao.isRegistered(); System.out.println("registered: " + isRegistered); if (isRegistered) { // progress finish and hide splash log.debug("user is registered"); // show frame1 } else { // progress finish and hide splash log.debug("user is not registered"); // show frame2 } } I don't have much experience with Swing, so please advise how to accomplish that. UPDATE: i have found the following example, but it have little issue: when the counter gets to the specified number it should stop at (300) it keeps counting for ever without stopping the timer and hiding the splash screen. i want to bind the counter to the file loading, so while the file is loaded the progress gets loaded until the file gets loaded then the progress completes and the splash screen disappears. @SuppressWarnings("serial") @Component public class SplashScreen extends JWindow { static boolean isRegistered; static Log log = LogFactory.getLog(SplashScreen.class); private static JProgressBar progressBar = new JProgressBar(); private static SplashScreen execute; private static int count; private static Timer timer1; public SplashScreen() { Container container = getContentPane(); container.setLayout(null); JPanel p
Tags (comma-separated)
Save Edits
Cancel