package com.dwave.gui; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SplashScreen extends Frame { Window splashWindow; JPanel splashPanel; ImageIcon splashImage; JLabel splashLabel; JProgressBar jpb; private SplashScreen() {} public SplashScreen(ImageIcon image, String labelText) { Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); splashImage=image; splashWindow = new Window(this); splashPanel = new JPanel(); splashLabel = new JLabel(splashImage); JPanel jp = new JPanel(new FlowLayout()); jp.setBackground(Color.black); jpb = new JProgressBar(JProgressBar.HORIZONTAL, 0, 50); jpb.setValue(0); jp.add(new DLabel(labelText, DLabel.theLargerFontBold)); jp.add(jpb); splashPanel.add(splashLabel); splashPanel.setSize(splashImage.getIconWidth()+10, splashImage.getIconHeight()+10); splashPanel.setBackground(Color.black); splashWindow.setBackground(Color.black); splashWindow.add(splashPanel, BorderLayout.CENTER); splashWindow.add(jp, BorderLayout.SOUTH); splashWindow.setSize(splashImage.getIconWidth()+10, splashImage.getIconHeight()+37); splashPanel.setVisible(true); splashWindow.setLocation((d.width-splashImage.getIconWidth())/2, (d.height-splashImage.getIconHeight())/2); splashWindow.setVisible(true); splashWindow.repaint(); splashWindow.paintComponents(splashWindow.getGraphics()); } public void incrementProgressBar() { jpb.setValue(jpb.getValue()+1);jpb.paintComponents(jpb.getGraphics());} }